Class: Esi::ApiError
- Inherits:
-
OAuth2::Error
- Object
- OAuth2::Error
- Esi::ApiError
- Defined in:
- lib/esi/api_error.rb
Overview
ApiError base class
Direct Known Subclasses
ApiBadRequestError, ApiForbiddenError, ApiInvalidAppClientKeysError, ApiNotFoundError, ApiRefreshTokenExpiredError, ApiUnknownError, RateLimitError, TemporaryServerError, TimeoutError, UnauthorizedError
Instance Attribute Summary collapse
-
#key ⇒ String
readonly
The response.data.
-
#message ⇒ String
readonly
The response error message.
-
#original_exception ⇒ ExceptionClass|nil
readonly
The orginal raised exception.
-
#response ⇒ Esi::Response
readonly
The ApiError Response.
-
#type ⇒ String
readonly
The response.data.
Instance Method Summary collapse
-
#initialize(response, original_exception = nil) ⇒ Esi::ApiError
constructor
Create a new instance of ApiError.
Constructor Details
#initialize(response, original_exception = nil) ⇒ Esi::ApiError
Create a new instance of ApiError
22 23 24 25 26 27 28 29 30 31 |
# 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] = response.data[:message].presence || response.data[:error] || original_exception.try(:message) @type = response.data[:exceptionType] end |
Instance Attribute Details
#key ⇒ String (readonly)
Returns the response.data.
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] = response.data[:message].presence || response.data[:error] || original_exception.try(:message) @type = response.data[:exceptionType] end end |
#message ⇒ String (readonly)
Returns the response error message.
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] = response.data[:message].presence || response.data[:error] || original_exception.try(:message) @type = response.data[:exceptionType] end end |
#original_exception ⇒ ExceptionClass|nil (readonly)
Returns the orginal raised exception.
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] = response.data[:message].presence || response.data[:error] || original_exception.try(:message) @type = response.data[:exceptionType] end end |
#response ⇒ Esi::Response (readonly)
Returns the ApiError Response.
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] = response.data[:message].presence || response.data[:error] || original_exception.try(:message) @type = response.data[:exceptionType] end end |
#type ⇒ String (readonly)
Returns the response.data.
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] = response.data[:message].presence || response.data[:error] || original_exception.try(:message) @type = response.data[:exceptionType] end end |