Sha256: 8b0d037ac35be98f7c9ae4ff3a3e5db17786fe3787321ad36ba00343f34f025b
Contents?: true
Size: 845 Bytes
Versions: 4
Compression:
Stored size: 845 Bytes
Contents
require 'excon' require 'peddler/errors/builder' module Peddler module Errors # @api private class Handler def self.call(exception) new(exception).handle end def self.parameters 1 end attr_reader :exception def initialize(exception) @exception = exception end def handle if http_status_error? raise error_class.new(exception.response.message, exception) else raise exception end rescue NameError raise exception end private def error_class Errors.const_get(exception.response.code) rescue NameError Builder.build(exception.response.code) end def http_status_error? exception.is_a?(::Excon::Error::HTTPStatus) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
peddler-1.6.0 | lib/peddler/errors/handler.rb |
peddler-1.5.0 | lib/peddler/errors/handler.rb |
peddler-1.4.1 | lib/peddler/errors/handler.rb |
peddler-1.4.0 | lib/peddler/errors/handler.rb |