Exception: OpenFec::ClientError
- Defined in:
- lib/open_fec/error.rb
Overview
Raised for 4xx HTTP responses.
Direct Known Subclasses
BadRequestError, ForbiddenError, NotFoundError, RateLimitError, UnauthorizedError, UnprocessableEntityError
Instance Attribute Summary collapse
-
#body ⇒ Hash, ...
readonly
Response body.
-
#status ⇒ Integer?
readonly
HTTP status code.
Instance Method Summary collapse
-
#initialize(message = nil, status: nil, body: nil) ⇒ ClientError
constructor
A new instance of ClientError.
Constructor Details
#initialize(message = nil, status: nil, body: nil) ⇒ ClientError
Returns a new instance of ClientError.
17 18 19 20 21 |
# File 'lib/open_fec/error.rb', line 17 def initialize( = nil, status: nil, body: nil) @status = status @body = body super( || "HTTP #{status}: #{body}") end |
Instance Attribute Details
#body ⇒ Hash, ... (readonly)
Returns response body.
12 13 14 |
# File 'lib/open_fec/error.rb', line 12 def body @body end |
#status ⇒ Integer? (readonly)
Returns HTTP status code.
10 11 12 |
# File 'lib/open_fec/error.rb', line 10 def status @status end |