Exception: Ingenico::Connect::SDK::ApiException
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Ingenico::Connect::SDK::ApiException
- Defined in:
- lib/ingenico/connect/sdk/api_exception.rb
Overview
Base class for many exceptions raised by the SDK. It is raised when an error response is received from the Ingenico ePayments platform. It contains data about the returned response.
Direct Known Subclasses
AuthorizationException, DeclinedTransactionException, GlobalCollectException, IdempotenceException, ReferenceException, ValidationException
Instance Attribute Summary collapse
-
#error_id ⇒ Object
readonly
An error id corresponding to the error that occurred, if available.
-
#errors ⇒ Object
readonly
A list of errors received from the Ingenico ePayments platform; may be empty but never nil.
-
#response_body ⇒ Object
readonly
Message body of the returned response.
-
#status_code ⇒ Object
readonly
HTTP status code of the returned response.
Instance Method Summary collapse
-
#initialize(status_code, response_body, error_id, errors, message = 'the Ingenico ePayments platform returned an error response') ⇒ ApiException
constructor
Creates a new ApiException that reports an error response from the Ingenico ePayments platform.
- #to_s ⇒ Object
Constructor Details
#initialize(status_code, response_body, error_id, errors, message = 'the Ingenico ePayments platform returned an error response') ⇒ ApiException
Creates a new ApiException that reports an error response from the Ingenico ePayments platform. It reports the following:
- status_code
-
HTTP status code the response
- response_body
-
HTTP response body
- error_id
-
Error id of the error, may be nil
- errors
-
A list of errors that occurred, may be empty
- message
-
Error message to include
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ingenico/connect/sdk/api_exception.rb', line 15 def initialize(status_code, response_body, error_id, errors, ='the Ingenico ePayments platform returned an error response') super() @status_code = status_code @response_body = response_body @error_id = error_id if errors.nil? @errors = [].freeze else @errors = errors end end |
Instance Attribute Details
#error_id ⇒ Object (readonly)
An error id corresponding to the error that occurred, if available.
35 36 37 |
# File 'lib/ingenico/connect/sdk/api_exception.rb', line 35 def error_id @error_id end |
#errors ⇒ Object (readonly)
A list of errors received from the Ingenico ePayments platform; may be empty but never nil
39 40 41 |
# File 'lib/ingenico/connect/sdk/api_exception.rb', line 39 def errors @errors end |
#response_body ⇒ Object (readonly)
Message body of the returned response.
32 33 34 |
# File 'lib/ingenico/connect/sdk/api_exception.rb', line 32 def response_body @response_body end |
#status_code ⇒ Object (readonly)
HTTP status code of the returned response.
29 30 31 |
# File 'lib/ingenico/connect/sdk/api_exception.rb', line 29 def status_code @status_code end |
Instance Method Details
#to_s ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ingenico/connect/sdk/api_exception.rb', line 41 def to_s str = super.to_s if @status_code > 0 str += '; status_code=' + @status_code.to_s end if !@response_body.nil? && @response_body.length > 0 str += "; response_body='" + @response_body + "'" end str.to_s end |