Exception: Shotwolf::Error

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

Overview

Raised for any non-2xx API response. type mirrors the API error envelope (invalid_params, insufficient_credits, rate_limited, ...). status is the HTTP status code (0 for client-side/transport errors).

Direct Known Subclasses

TimeoutError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, type: "unknown", status: 0, request_id: nil, retry_after: nil) ⇒ Error

Returns a new instance of Error.



10
11
12
13
14
15
16
# File 'lib/shotwolf/errors.rb', line 10

def initialize(message, type: "unknown", status: 0, request_id: nil, retry_after: nil)
  super(message)
  @type = type
  @status = status
  @request_id = request_id
  @retry_after = retry_after
end

Instance Attribute Details

#request_idObject (readonly)

Returns the value of attribute request_id.



8
9
10
# File 'lib/shotwolf/errors.rb', line 8

def request_id
  @request_id
end

#retry_afterObject (readonly)

Returns the value of attribute retry_after.



8
9
10
# File 'lib/shotwolf/errors.rb', line 8

def retry_after
  @retry_after
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/shotwolf/errors.rb', line 8

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/shotwolf/errors.rb', line 8

def type
  @type
end