Exception: Pangram::APIError

Inherits:
Error
  • Object
show all
Defined in:
lib/pangram/errors.rb

Overview

Raised when Pangram rejects a request or an asynchronous task fails.

Direct Known Subclasses

InvalidResponseError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status: nil, body: nil) ⇒ APIError

Returns a new instance of APIError.



22
23
24
25
26
# File 'lib/pangram/errors.rb', line 22

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

Instance Attribute Details

#bodyObject (readonly)

Raw response body of the failed response, when available.



20
21
22
# File 'lib/pangram/errors.rb', line 20

def body
  @body
end

#statusObject (readonly)

HTTP status code of the failed response, when available.



17
18
19
# File 'lib/pangram/errors.rb', line 17

def status
  @status
end