Exception: Crawlora::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Crawlora::Error
- Defined in:
- lib/crawlora/errors.rb
Overview
Base class for every error raised by the SDK. Carries the HTTP status, the parsed API ‘code`/body, the raw response text, response headers, and the request id (when request-id tracking is enabled).
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#cause ⇒ Object
readonly
Returns the value of attribute cause.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#raw_body ⇒ Object
readonly
Returns the value of attribute raw_body.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message, status: 0, code: nil, body: nil, raw_body: "", headers: nil, request_id: nil, cause: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message, status: 0, code: nil, body: nil, raw_body: "", headers: nil, request_id: nil, cause: nil) ⇒ Error
Returns a new instance of Error.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/crawlora/errors.rb', line 10 def initialize(, status: 0, code: nil, body: nil, raw_body: "", headers: nil, request_id: nil, cause: nil) super() @status = status @code = code @body = body @raw_body = raw_body @headers = headers ? headers.dup : {} @request_id = request_id @cause = cause end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/crawlora/errors.rb', line 8 def body @body end |
#cause ⇒ Object (readonly)
Returns the value of attribute cause.
8 9 10 |
# File 'lib/crawlora/errors.rb', line 8 def cause @cause end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
8 9 10 |
# File 'lib/crawlora/errors.rb', line 8 def code @code end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
8 9 10 |
# File 'lib/crawlora/errors.rb', line 8 def headers @headers end |
#raw_body ⇒ Object (readonly)
Returns the value of attribute raw_body.
8 9 10 |
# File 'lib/crawlora/errors.rb', line 8 def raw_body @raw_body end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
8 9 10 |
# File 'lib/crawlora/errors.rb', line 8 def request_id @request_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/crawlora/errors.rb', line 8 def status @status end |