Exception: Luchadeer::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/luchadeer/error.rb

Defined Under Namespace

Modules: Codes

Class Method Summary collapse

Class Method Details

.api_errorsObject

Used for bespoke status codes returned in the response body



15
16
17
18
19
20
21
22
23
# File 'lib/luchadeer/error.rb', line 15

def self.api_errors
  {
    Codes::INVALID_API_KEY  => Luchadeer::Error::InvalidAPIKey,
    Codes::OBJECT_NOT_FOUND => Luchadeer::Error::NotFound,
    Codes::URL_FORMAT_ERROR => Luchadeer::Error::URLFormatError,
    Codes::FILTER_ERROR     => Luchadeer::Error::FilterError,
    Codes::SUBSCRIBER_ONLY  => Luchadeer::Error::SubscriberOnly
  }
end

.http_errorsObject

Used for HTTP status codes



26
27
28
29
30
31
32
33
34
35
# File 'lib/luchadeer/error.rb', line 26

def self.http_errors
  {
    400 => Luchadeer::Error::BadRequest,
    404 => Luchadeer::Error::NotFound,
    500 => Luchadeer::Error::InternalServerError,
    502 => Luchadeer::Error::InternalServerError, # unconfirmed
    503 => Luchadeer::Error::InternalServerError, # unconfirmed
    504 => Luchadeer::Error::InternalServerError, # unconfirmed
  }
end