Exception: Boldsign::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/boldsign/error.rb

Overview

Base class for all errors raised by this gem. HTTP failures raise a typed subclass; carry the status code, parsed body, and Faraday response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, status: nil, body: nil, response: nil) ⇒ Error

Returns a new instance of Error.



12
13
14
15
16
17
# File 'lib/boldsign/error.rb', line 12

def initialize(message = nil, status: nil, body: nil, response: nil)
  super(message)
  @status = status
  @body = body
  @response = response
end

Instance Attribute Details

#bodyHash, ... (readonly)

Returns parsed response body (JSON Hash) or raw body string.

Returns:

  • (Hash, String, nil)

    parsed response body (JSON Hash) or raw body string.



8
9
10
# File 'lib/boldsign/error.rb', line 8

def body
  @body
end

#responseFaraday::Response? (readonly)

Returns underlying Faraday response.

Returns:

  • (Faraday::Response, nil)

    underlying Faraday response.



10
11
12
# File 'lib/boldsign/error.rb', line 10

def response
  @response
end

#statusInteger? (readonly)

Returns HTTP status code, when the error originated from a response.

Returns:

  • (Integer, nil)

    HTTP status code, when the error originated from a response.



6
7
8
# File 'lib/boldsign/error.rb', line 6

def status
  @status
end