Exception: Ghostcrawl::GhostcrawlError
- Inherits:
-
StandardError
- Object
- StandardError
- Ghostcrawl::GhostcrawlError
- Defined in:
- lib/ghostcrawl/errors.rb
Overview
Base error for all GhostCrawl API errors.
Direct Known Subclasses
APIError, AuthenticationError, InvalidRequestError, PaymentRequiredError, RateLimitError, ScrapeError
Instance Attribute Summary collapse
-
#body ⇒ String
readonly
Raw response body.
-
#code ⇒ String?
readonly
Canonical error code (see ErrorCodes).
-
#request_id ⇒ String?
readonly
Request id (the problem+json
instance) for support. -
#retryable ⇒ Boolean
readonly
Whether the operation is safe to retry.
-
#status_code ⇒ Integer
readonly
HTTP status code.
Instance Method Summary collapse
-
#initialize(message, status_code: 0, body: nil, code: nil, retryable: false, request_id: nil) ⇒ GhostcrawlError
constructor
A new instance of GhostcrawlError.
Constructor Details
#initialize(message, status_code: 0, body: nil, code: nil, retryable: false, request_id: nil) ⇒ GhostcrawlError
Returns a new instance of GhostcrawlError.
20 21 22 23 24 25 26 27 |
# File 'lib/ghostcrawl/errors.rb', line 20 def initialize(, status_code: 0, body: nil, code: nil, retryable: false, request_id: nil) super() @status_code = status_code @body = body @code = code @retryable = retryable @request_id = request_id end |
Instance Attribute Details
#body ⇒ String (readonly)
Returns raw response body.
12 13 14 |
# File 'lib/ghostcrawl/errors.rb', line 12 def body @body end |
#code ⇒ String? (readonly)
Returns canonical error code (see ErrorCodes).
14 15 16 |
# File 'lib/ghostcrawl/errors.rb', line 14 def code @code end |
#request_id ⇒ String? (readonly)
Returns request id (the problem+json instance) for support.
18 19 20 |
# File 'lib/ghostcrawl/errors.rb', line 18 def request_id @request_id end |
#retryable ⇒ Boolean (readonly)
Returns whether the operation is safe to retry.
16 17 18 |
# File 'lib/ghostcrawl/errors.rb', line 16 def retryable @retryable end |
#status_code ⇒ Integer (readonly)
Returns HTTP status code.
10 11 12 |
# File 'lib/ghostcrawl/errors.rb', line 10 def status_code @status_code end |