Exception: Craigslist::API::ResponseError
- Defined in:
- lib/craigslist/api/errors.rb
Overview
Raised when Craigslist returned a response we understand as a failure.
Carries the HTTP status and raw body so callers can inspect what actually came back, plus any structured errors extracted from a JSON envelope.
Direct Known Subclasses
APIError, AuthenticationError, NotFoundError, RateLimitError, RequestError, ServerError
Instance Attribute Summary collapse
-
#api_errors ⇒ Array<Hash>
readonly
Structured
{code:, message:}entries, when present. -
#body ⇒ String?
readonly
Raw response body.
-
#status ⇒ Integer?
readonly
HTTP status code.
Instance Method Summary collapse
-
#initialize(message = nil, status: nil, body: nil, api_errors: []) ⇒ ResponseError
constructor
A new instance of ResponseError.
Constructor Details
#initialize(message = nil, status: nil, body: nil, api_errors: []) ⇒ ResponseError
Returns a new instance of ResponseError.
50 51 52 53 54 55 |
# File 'lib/craigslist/api/errors.rb', line 50 def initialize( = nil, status: nil, body: nil, api_errors: []) @status = status @body = body @api_errors = api_errors super() end |
Instance Attribute Details
#api_errors ⇒ Array<Hash> (readonly)
Returns structured {code:, message:} entries, when present.
48 49 50 |
# File 'lib/craigslist/api/errors.rb', line 48 def api_errors @api_errors end |
#body ⇒ String? (readonly)
Returns raw response body.
45 46 47 |
# File 'lib/craigslist/api/errors.rb', line 45 def body @body end |
#status ⇒ Integer? (readonly)
Returns HTTP status code.
42 43 44 |
# File 'lib/craigslist/api/errors.rb', line 42 def status @status end |