class Esi::ApiError
ApiError
base class @!attribute [r] response
@return [Esi::Response] the ApiError Response
@!attribute [r] key
@return [String] the response.data[:key]
@!attribute [r] message
@return [String] the response error message
@!attribute [r] type
@return [String] the response.data[:exceptionType]
@!attribute [r] original_exception
@return [ExceptionClass|nil] the orginal raised exception
Attributes
key[R]
message[R]
original_exception[R]
response[R]
type[R]
Public Class Methods
new(response, original_exception = nil)
click to toggle source
Create a new instance of ApiError
@param response [Esi::Response] response the response that generated the exception @param original_exception
[ExceptionClass|nil] the orginally raised exception @return [Esi::ApiError] an instance of ApiError
Calls superclass method
# File lib/esi/api_error.rb, line 22 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] @message = response.data[:message].presence || response.data[:error] || original_exception.try(:message) @type = response.data[:exceptionType] end