Method: Esi::ApiError#type

Defined in:
lib/esi/api_error.rb,
lib/esi/api_error.rb

#typeString (readonly)

Returns the response.data.

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/esi/api_error.rb', line 15

class ApiError < OAuth2::Error
  attr_reader :response, :key, :message, :type, :original_exception

  # 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
  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
end