Exception: Ghostcrawl::GhostcrawlError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ghostcrawl/errors.rb

Overview

Base error for all GhostCrawl API errors.

Instance Attribute Summary collapse

Instance Method Summary collapse

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(message, status_code: 0, body: nil, code: nil, retryable: false, request_id: nil)
  super(message)
  @status_code = status_code
  @body = body
  @code = code
  @retryable = retryable
  @request_id = request_id
end

Instance Attribute Details

#bodyString (readonly)

Returns raw response body.

Returns:

  • (String)

    raw response body



12
13
14
# File 'lib/ghostcrawl/errors.rb', line 12

def body
  @body
end

#codeString? (readonly)

Returns canonical error code (see ErrorCodes).

Returns:

  • (String, nil)

    canonical error code (see ErrorCodes)



14
15
16
# File 'lib/ghostcrawl/errors.rb', line 14

def code
  @code
end

#request_idString? (readonly)

Returns request id (the problem+json instance) for support.

Returns:

  • (String, nil)

    request id (the problem+json instance) for support



18
19
20
# File 'lib/ghostcrawl/errors.rb', line 18

def request_id
  @request_id
end

#retryableBoolean (readonly)

Returns whether the operation is safe to retry.

Returns:

  • (Boolean)

    whether the operation is safe to retry



16
17
18
# File 'lib/ghostcrawl/errors.rb', line 16

def retryable
  @retryable
end

#status_codeInteger (readonly)

Returns HTTP status code.

Returns:

  • (Integer)

    HTTP status code



10
11
12
# File 'lib/ghostcrawl/errors.rb', line 10

def status_code
  @status_code
end