Class: Paddle::ErrorFactory
- Inherits:
-
Object
- Object
- Paddle::ErrorFactory
- Defined in:
- lib/paddle/error_generator.rb
Constant Summary collapse
- HTTP_ERROR_MAP =
{ 400 => Errors::BadRequestError, 401 => Errors::AuthenticationMissingError, 403 => Errors::ForbiddenError, 404 => Errors::EntityNotFoundError, 409 => Errors::ConflictError, 429 => Errors::TooManyRequestsError, 500 => Errors::InternalError, 503 => Errors::ServiceUnavailableError, 501 => Errors::NotImplementedError }.freeze
Class Method Summary collapse
Class Method Details
.create(response_body, http_status_code) ⇒ Object
122 123 124 125 126 |
# File 'lib/paddle/error_generator.rb', line 122 def self.create(response_body, http_status_code) status = http_status_code error_class = HTTP_ERROR_MAP[status] || ErrorGenerator error_class.new(response_body, http_status_code) if error_class end |