Exception: Worldline::Connect::SDK::V1::ApiException
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Worldline::Connect::SDK::V1::ApiException
- Defined in:
- lib/worldline/connect/sdk/v1/api_exception.rb
Overview
Base class for many exceptions raised by the SDK. It is raised when an error response is received from the Worldline Global Collect platform. It contains data about the returned response.
Direct Known Subclasses
AuthorizationException, DeclinedTransactionException, IdempotenceException, PlatformException, ReferenceException, ValidationException
Instance Attribute Summary collapse
-
#error_id ⇒ String
readonly
An error id corresponding to the error that occurred, if available.
-
#errors ⇒ Array<Worldline::Connect::SDK::V1::Domain::APIError>
readonly
A list of errors received from the Worldline Global Collect platform; may be empty but never nil.
-
#response_body ⇒ String
readonly
Message body of the returned response.
-
#status_code ⇒ Integer
readonly
HTTP status code of the returned response.
Instance Method Summary collapse
-
#initialize(status_code, response_body, error_id, errors, message = 'the Worldline Global Collect platform returned an error response') ⇒ ApiException
constructor
Creates a new ApiException that reports an error response from the Worldline Global Collect platform.
- #to_s ⇒ Object
Constructor Details
#initialize(status_code, response_body, error_id, errors, message = 'the Worldline Global Collect platform returned an error response') ⇒ ApiException
Creates a new ApiException that reports an error response from the Worldline Global Collect platform.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/worldline/connect/sdk/v1/api_exception.rb', line 29 def initialize(status_code, response_body, error_id, errors, ='the Worldline Global Collect 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 ⇒ String (readonly)
An error id corresponding to the error that occurred, if available.
20 21 22 |
# File 'lib/worldline/connect/sdk/v1/api_exception.rb', line 20 def error_id @error_id end |
#errors ⇒ Array<Worldline::Connect::SDK::V1::Domain::APIError> (readonly)
A list of errors received from the Worldline Global Collect platform; may be empty but never nil
20 21 22 |
# File 'lib/worldline/connect/sdk/v1/api_exception.rb', line 20 def errors @errors end |
#response_body ⇒ String (readonly)
Message body of the returned response.
20 21 22 |
# File 'lib/worldline/connect/sdk/v1/api_exception.rb', line 20 def response_body @response_body end |
#status_code ⇒ Integer (readonly)
HTTP status code of the returned response.
20 21 22 |
# File 'lib/worldline/connect/sdk/v1/api_exception.rb', line 20 def status_code @status_code end |
Instance Method Details
#to_s ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/worldline/connect/sdk/v1/api_exception.rb', line 47 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 |