class Simplify::ApiException
Base class for all API exceptions.
Attributes
errorCode[R]
API code for the error.
errorData[R]
Error data returned from the API represented as a map.
errorMessage[R]
Description of the error.
reference[R]
Unique reference ID for the API error.
status[R]
HTML status code (or nil if there is no status code)
Public Class Methods
new(message, status, errorData)
click to toggle source
Calls superclass method
# File lib/simplify/apiexception.rb, line 49 def initialize(message, status, errorData) super(message) @status = status @errorMessage = message @fieldErrors = [] if errorData != nil @errorData = errorData @reference = errorData.has_key?('reference') ? errorData['reference'] : nil if errorData.has_key?('error') error = errorData['error'] @errorCode = error['code'] if error.has_key?('message') message = error['message'] end end end super(message) end
Public Instance Methods
describe()
click to toggle source
Returns a string descrption of the error.
# File lib/simplify/apiexception.rb, line 71 def describe() return "#{self.class}: \"#{self.to_s()}\" (status: #{@status}, error code #{@errorCode}, reference: #{@reference})" end