Exception: Airwallex::HTTPError
- Defined in:
- lib/airwallex/errors.rb
Direct Known Subclasses
BadRequestError, ConflictError, ForbiddenError, InvalidResponseError, NotFoundError, RateLimitError, ServerError, TimeoutError, UnauthorizedError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#response_body ⇒ Object
readonly
Returns the value of attribute response_body.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = nil, **attrs) ⇒ HTTPError
constructor
A new instance of HTTPError.
Constructor Details
#initialize(message = nil, **attrs) ⇒ HTTPError
Returns a new instance of HTTPError.
19 20 21 22 23 24 25 26 |
# File 'lib/airwallex/errors.rb', line 19 def initialize( = nil, **attrs) super() @status = attrs[:status] @code = attrs[:code] @source = attrs[:source] @details = attrs[:details] @response_body = attrs[:response_body] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
17 18 19 |
# File 'lib/airwallex/errors.rb', line 17 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
17 18 19 |
# File 'lib/airwallex/errors.rb', line 17 def details @details end |
#response_body ⇒ Object (readonly)
Returns the value of attribute response_body.
17 18 19 |
# File 'lib/airwallex/errors.rb', line 17 def response_body @response_body end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
17 18 19 |
# File 'lib/airwallex/errors.rb', line 17 def source @source end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
17 18 19 |
# File 'lib/airwallex/errors.rb', line 17 def status @status end |
Class Method Details
.raise_for_response!(status, parsed_body, raw_body) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/airwallex/errors.rb', line 28 def self.raise_for_response!(status, parsed_body, raw_body) fields = parsed_body.is_a?(Hash) ? parsed_body : {} raise error_class_for(status).new( (parsed_body, status), status: status, code: fields["code"], source: fields["source"], details: fields["details"], response_body: raw_body ) end |