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.



21
22
23
# File 'lib/peddler/errors/handler.rb', line 21

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.



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

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.



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

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.



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

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.

Raises:

  • (error_class)


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

def handle
  raise exception unless http_status_error?
  raise exception if bad_name_for_error_class?

  raise error_class.new(error_message, exception)
end