Exception: Webpipe::ApiError
- Defined in:
- lib/webpipe/errors.rb
Overview
An error response returned by the WebPipe API. Always carries the server's original error message and the HTTP status code.
Direct Known Subclasses
AuthenticationError, BadRequestError, ForbiddenError, NotFoundError, RateLimitError, ServerError
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(message, status_code:, body: nil) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(message, status_code:, body: nil) ⇒ ApiError
Returns a new instance of ApiError.
12 13 14 15 16 |
# File 'lib/webpipe/errors.rb', line 12 def initialize(, status_code:, body: nil) super("[#{status_code}] #{}") @status_code = status_code @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
10 11 12 |
# File 'lib/webpipe/errors.rb', line 10 def body @body end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
10 11 12 |
# File 'lib/webpipe/errors.rb', line 10 def status_code @status_code end |