Sha256: 6e10256825768b6ad524c000acf7c8ac8970afc1d2940123cc14a0b689c4068d
Contents?: true
Size: 1.51 KB
Versions: 81
Compression:
Stored size: 1.51 KB
Contents
module Eco module API module Common module Loaders class ErrorHandler < Eco::API::Common::Loaders::CaseBase class << self attr_writer :error # @return [Eco::API::Error] the error class, child of `Eco::API::Error`. def error(value = nil) unless value return @error || raise("You should specify an error type for #{self.class}") end @error = value end end inheritable_class_vars :error 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 # @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. def main(people, session, options, handler, job) raise "You should implement this method" end def error self.class.error end end end end end end
Version data entries
81 entries across 81 versions & 1 rubygems