Exception: NakoPay::APIError
- Defined in:
- lib/nakopay/errors.rb
Overview
Raised for any non-2xx HTTP response.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#doc_url ⇒ Object
readonly
Returns the value of attribute doc_url.
-
#param ⇒ Object
readonly
Returns the value of attribute param.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(message:, code: nil, type: nil, param: nil, doc_url: nil, request_id: nil, status_code: nil) ⇒ APIError
constructor
A new instance of APIError.
-
#retryable? ⇒ Boolean
True for 429/5xx errors that may succeed on retry.
Constructor Details
#initialize(message:, code: nil, type: nil, param: nil, doc_url: nil, request_id: nil, status_code: nil) ⇒ APIError
Returns a new instance of APIError.
9 10 11 12 13 14 15 16 17 |
# File 'lib/nakopay/errors.rb', line 9 def initialize(message:, code: nil, type: nil, param: nil, doc_url: nil, request_id: nil, status_code: nil) super() @code = code @type = type @param = param @doc_url = doc_url @request_id = request_id @status_code = status_code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'lib/nakopay/errors.rb', line 7 def code @code end |
#doc_url ⇒ Object (readonly)
Returns the value of attribute doc_url.
7 8 9 |
# File 'lib/nakopay/errors.rb', line 7 def doc_url @doc_url end |
#param ⇒ Object (readonly)
Returns the value of attribute param.
7 8 9 |
# File 'lib/nakopay/errors.rb', line 7 def param @param end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
7 8 9 |
# File 'lib/nakopay/errors.rb', line 7 def request_id @request_id end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
7 8 9 |
# File 'lib/nakopay/errors.rb', line 7 def status_code @status_code end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/nakopay/errors.rb', line 7 def type @type end |
Instance Method Details
#retryable? ⇒ Boolean
True for 429/5xx errors that may succeed on retry.
20 21 22 |
# File 'lib/nakopay/errors.rb', line 20 def retryable? @status_code == 429 || (@status_code && @status_code >= 500) end |