Class: Eco::API::Common::Loaders::ErrorHandler
- Defined in:
- lib/eco/api/common/loaders/error_handler.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.error(value = nil) ⇒ Eco::API::Error
The error class, child of
Eco::API::Error.
Attributes included from Language::AuxiliarLogger
Instance Method Summary collapse
- #error ⇒ Object
-
#initialize(handlers) ⇒ ErrorHandler
constructor
A new instance of ErrorHandler.
- #main(people, session, options, handler, job) ⇒ Object
Methods inherited from CaseBase
Methods inherited from Base
<=>, created_at, set_created_at!
Methods included from ClassHelpers
#class_resolver, #descendants, #descendants?, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant
Methods included from Language::AuxiliarLogger
Constructor Details
#initialize(handlers) ⇒ ErrorHandler
Returns a new instance of ErrorHandler.
20 21 22 23 |
# File 'lib/eco/api/common/loaders/error_handler.rb', line 20 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 |
Class Attribute Details
.error(value = nil) ⇒ Eco::API::Error
Returns the error class, child of Eco::API::Error.
10 11 12 13 14 15 |
# File 'lib/eco/api/common/loaders/error_handler.rb', line 10 def error(value = nil) unless value return @error || raise("You should specify an error type for #{self.class}") end @error = value end |
Instance Method Details
#error ⇒ Object
34 35 36 |
# File 'lib/eco/api/common/loaders/error_handler.rb', line 34 def error self.class.error end |
#main(people, session, options, handler, job) ⇒ Object
30 31 32 |
# File 'lib/eco/api/common/loaders/error_handler.rb', line 30 def main(people, session, , handler, job) raise "You should implement this method" end |