class Eco::API::Common::Loaders::ErrorHandler

Attributes

error[W]

Public Class Methods

error(value = nil) click to toggle source

@return [Eco::API::Error] the error class, child of `Eco::API::Error`.

# File lib/eco/api/common/loaders/error_handler.rb, line 11
def error(value = nil)
  unless value
    return @error || raise("You should specify an error type for #{self.class}")
  end
  @error = value
end
new(handlers) click to toggle source
# File lib/eco/api/common/loaders/error_handler.rb, line 21
def initialize(handlers)
  raise "Expected Eco::API::Policies. Given #{handlers.class}" unless handlers.is_a?(Eco::API::Error::Handlers)
  handlers.on(self.error, &self.method(:main))
end

Public Instance Methods

error() click to toggle source
# File lib/eco/api/common/loaders/error_handler.rb, line 35
def error
  self.class.error
end
main(people, session, options, handler, job) click to toggle source

@param people [Eco::API::Organization::People] the people in the queue of the current `job` @param session [Eco::API::Session] the current session where the usecase kicks in. @param options [Hash] the options that modify the case behaviour or bring some dependencies. @param handler [Eco::API::Error::Hanlder] the `error handler` instance object. @param job [Eco::API::Session::Batch::Job] the `Batch::Job` made on purpose for this handler.

# File lib/eco/api/common/loaders/error_handler.rb, line 31
def main(people, session, options, handler, job)
  raise "You should implement this method"
end