Class: ActiveCampaign::ExceptionHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/active-campaign-simple/exception_handler.rb

Constant Summary collapse

ERRORS =
{
  '404 Not Found' => ActiveCampaign::NotFoundError
}

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ ExceptionHandler

Returns a new instance of ExceptionHandler.



10
11
12
13
14
15
16
17
# File 'lib/active-campaign-simple/exception_handler.rb', line 10

def initialize(error)
  error_class = ERRORS[error.message]
  if error_class
    raise error_class.new(error)
  else
    raise ActiveCampaign::APIError.new(error)
  end
end