Class: Peddler::Errors::Handler Private

Inherits:
Object
  • Object
show all
Defined in:
lib/peddler/errors/handler.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception) ⇒ Handler

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Handler.



18
19
20
# File 'lib/peddler/errors/handler.rb', line 18

def initialize(exception)
  @exception = exception
end

Instance Attribute Details

#exceptionObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/peddler/errors/handler.rb', line 16

def exception
  @exception
end

Class Method Details

.call(exception) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
# File 'lib/peddler/errors/handler.rb', line 8

def self.call(exception)
  new(exception).handle
end

.parametersObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/peddler/errors/handler.rb', line 12

def self.parameters
  1
end

Instance Method Details

#handleObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
25
26
27
28
29
30
# File 'lib/peddler/errors/handler.rb', line 22

def handle
  if http_status_error?
    raise error_class.new(exception.response.message, exception)
  else
    raise exception
  end
rescue NameError
  raise exception
end