Class: Esi::ApiError
- Inherits:
-
OAuth2::Error
- Object
- OAuth2::Error
- Esi::ApiError
- Defined in:
- lib/esi.rb
Direct Known Subclasses
ApiBadRequestError, ApiForbiddenError, ApiInvalidAppClientKeysError, ApiNotFoundError, ApiRefreshTokenExpiredError, ApiUnknownError
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#original_exception ⇒ Object
readonly
Returns the value of attribute original_exception.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(response, original_exception = nil) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(response, original_exception = nil) ⇒ ApiError
Returns a new instance of ApiError.
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/esi.rb', line 111 def initialize(response, original_exception=nil) super(response.original_response) @response = response @original_exception = original_exception @code = response.original_response.status @key = response.data[:key] = response.data[:message].presence || response.data[:error] || original_exception.try(:message) @type = response.data[:exceptionType] end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
109 110 111 |
# File 'lib/esi.rb', line 109 def key @key end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
109 110 111 |
# File 'lib/esi.rb', line 109 def end |
#original_exception ⇒ Object (readonly)
Returns the value of attribute original_exception.
109 110 111 |
# File 'lib/esi.rb', line 109 def original_exception @original_exception end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
109 110 111 |
# File 'lib/esi.rb', line 109 def response @response end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
109 110 111 |
# File 'lib/esi.rb', line 109 def type @type end |