Sha256: ef88885e4c823bddd44ddf6da4ddbf954c6cd8dabcb36804a542c1c201a17da4

Contents?: true

Size: 656 Bytes

Versions: 24

Compression:

Stored size: 656 Bytes

Contents

module Eco
  module API
    class Error
      class Handlers < Eco::API::UseCases

        def add(handler)
          raise "Expected Eco::API::Error::Handler object. Given: #{policy}" unless handler.is_a?(Eco::API::Error::Handler)
          super(handler)
        end

        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

      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
eco-helpers-1.5.1 lib/eco/api/error/handlers.rb
eco-helpers-1.5.0 lib/eco/api/error/handlers.rb
eco-helpers-1.4.2 lib/eco/api/error/handlers.rb
eco-helpers-1.3.19 lib/eco/api/error/handlers.rb
eco-helpers-1.4.1 lib/eco/api/error/handlers.rb
eco-helpers-1.4.0 lib/eco/api/error/handlers.rb
eco-helpers-1.3.18 lib/eco/api/error/handlers.rb
eco-helpers-1.3.17 lib/eco/api/error/handlers.rb
eco-helpers-1.3.16 lib/eco/api/error/handlers.rb
eco-helpers-1.3.15 lib/eco/api/error/handlers.rb
eco-helpers-1.3.14 lib/eco/api/error/handlers.rb
eco-helpers-1.3.13 lib/eco/api/error/handlers.rb
eco-helpers-1.3.12 lib/eco/api/error/handlers.rb
eco-helpers-1.3.11 lib/eco/api/error/handlers.rb
eco-helpers-1.3.10 lib/eco/api/error/handlers.rb
eco-helpers-1.3.9 lib/eco/api/error/handlers.rb
eco-helpers-1.3.8 lib/eco/api/error/handlers.rb
eco-helpers-1.3.7 lib/eco/api/error/handlers.rb
eco-helpers-1.3.6 lib/eco/api/error/handlers.rb
eco-helpers-1.3.5 lib/eco/api/error/handlers.rb