Exception: BudaApi::Errors::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- BudaApi::Errors::ApiError
- Defined in:
- lib/buda_api/errors.rb
Overview
Base error class for all API errors
Direct Known Subclasses
AuthenticationError, AuthorizationError, BadRequestError, ConnectionError, InvalidResponseError, NotFoundError, RateLimitError, ServerError, TimeoutError
Instance Attribute Summary collapse
-
#response_body ⇒ Object
readonly
Returns the value of attribute response_body.
-
#response_headers ⇒ Object
readonly
Returns the value of attribute response_headers.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(message, status_code: nil, response_body: nil, response_headers: nil) ⇒ ApiError
constructor
A new instance of ApiError.
- #to_s ⇒ Object
Constructor Details
#initialize(message, status_code: nil, response_body: nil, response_headers: nil) ⇒ ApiError
Returns a new instance of ApiError.
10 11 12 13 14 15 |
# File 'lib/buda_api/errors.rb', line 10 def initialize(, status_code: nil, response_body: nil, response_headers: nil) super() @status_code = status_code @response_body = response_body @response_headers = response_headers end |
Instance Attribute Details
#response_body ⇒ Object (readonly)
Returns the value of attribute response_body.
8 9 10 |
# File 'lib/buda_api/errors.rb', line 8 def response_body @response_body end |
#response_headers ⇒ Object (readonly)
Returns the value of attribute response_headers.
8 9 10 |
# File 'lib/buda_api/errors.rb', line 8 def response_headers @response_headers end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
8 9 10 |
# File 'lib/buda_api/errors.rb', line 8 def status_code @status_code end |
Instance Method Details
#to_s ⇒ Object
17 18 19 20 21 |
# File 'lib/buda_api/errors.rb', line 17 def to_s msg = super msg += " (HTTP #{@status_code})" if @status_code msg end |