Class: Eco::API::Error::Handlers
- Defined in:
- lib/eco/api/error/handlers.rb
Instance Method Summary collapse
Methods inherited from UseCases
#case, #define, #defined?, #each, #empty?, #initialize, #items, #length, #merge, #name?, #names, #types
Constructor Details
This class inherits a constructor from Eco::API::UseCases
Instance Method Details
#add(handler) ⇒ Object
6 7 8 9 |
# File 'lib/eco/api/error/handlers.rb', line 6 def add(handler) raise "Expected Eco::API::Error::Handler object. Given: #{policy}" unless handler.is_a?(Eco::API::Error::Handler) super(handler) end |
#on(klass_err, type: :error_handler, retry: true, &block) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/eco/api/error/handlers.rb', line 11 def on(klass_err, type: :error_handler, retry: true, &block) Eco::API::Error.validate_err_class(klass_err) raise "Expected block but not given" unless block Eco::API::Error::Handler.new(klass_err, type: type, root: self, &block).tap do |handler| add(handler) end end |