Exception: TocDoc::ResponseError
- Defined in:
- lib/toc_doc/core/error.rb
Overview
Raised when an HTTP response is received but indicates an error.
Carries the raw response details so callers can act on them without needing to reach into Faraday internals.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ String?
readonly
The raw response body.
-
#headers ⇒ Hash?
readonly
The response headers.
-
#status ⇒ Integer
readonly
The HTTP status code.
Instance Method Summary collapse
-
#initialize(status:, body: nil, headers: nil, message: nil) ⇒ ResponseError
constructor
A new instance of ResponseError.
Constructor Details
#initialize(status:, body: nil, headers: nil, message: nil) ⇒ ResponseError
Returns a new instance of ResponseError.
53 54 55 56 57 58 |
# File 'lib/toc_doc/core/error.rb', line 53 def initialize(status:, body: nil, headers: nil, message: nil) @status = status @body = body @headers = headers super( || "HTTP #{status}") end |
Instance Attribute Details
#body ⇒ String? (readonly)
Returns the raw response body.
43 44 45 |
# File 'lib/toc_doc/core/error.rb', line 43 def body @body end |
#headers ⇒ Hash? (readonly)
Returns the response headers.
46 47 48 |
# File 'lib/toc_doc/core/error.rb', line 46 def headers @headers end |
#status ⇒ Integer (readonly)
Returns the HTTP status code.
40 41 42 |
# File 'lib/toc_doc/core/error.rb', line 40 def status @status end |