Class: Plaid::ErrorErrorException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- Plaid::ErrorErrorException
- Defined in:
- lib/plaid/exceptions/error_error_exception.rb
Overview
We use standard HTTP response codes for success and failure notifications, and our errors are further classified by ‘error_type`. In general, 200 HTTP codes correspond to success, 40X codes are for developer- or user-related failures, and 50X codes are for Plaid-related issues. Error fields will be `null` if no error has occurred.
Instance Attribute Summary collapse
-
#causes ⇒ Array[Object]
In the Assets product, a request can pertain to more than one Item.
-
#display_message ⇒ String
A user-friendly representation of the error code.
-
#documentation_url ⇒ String
The URL of a Plaid documentation page with more information about the error.
-
#error_code ⇒ String
The particular error code.
-
#error_message ⇒ String
A developer-friendly representation of the error code.
-
#error_type ⇒ ErrorType
A broad categorization of the error.
-
#request_id ⇒ String
A unique ID identifying the request, to be used for troubleshooting purposes.
-
#status ⇒ Float
The HTTP status code associated with the error.
-
#suggested_action ⇒ String
Suggested steps for resolving the error.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ ErrorErrorException
constructor
The constructor.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ ErrorErrorException
The constructor.
65 66 67 68 69 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 65 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#causes ⇒ Array[Object]
In the Assets product, a request can pertain to more than one Item. If an error is returned for such a request, ‘causes` will return an array of errors containing a breakdown of these errors on the individual Item level, if any can be identified. `causes` will only be provided for the `error_type` `ASSET_REPORT_ERROR`.
46 47 48 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 46 def causes @causes end |
#display_message ⇒ String
A user-friendly representation of the error code. ‘null` if the error is not related to user action. This may change over time and is not safe for programmatic use.
33 34 35 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 33 def @display_message end |
#documentation_url ⇒ String
The URL of a Plaid documentation page with more information about the error
56 57 58 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 56 def documentation_url @documentation_url end |
#error_code ⇒ String
The particular error code. Safe for programmatic use.
22 23 24 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 22 def error_code @error_code end |
#error_message ⇒ String
A developer-friendly representation of the error code. This may change over time and is not safe for programmatic use.
27 28 29 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 27 def @error_message end |
#error_type ⇒ ErrorType
A broad categorization of the error. Safe for programatic use.
18 19 20 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 18 def error_type @error_type end |
#request_id ⇒ String
A unique ID identifying the request, to be used for troubleshooting purposes. This field will be omitted in errors provided by webhooks.
38 39 40 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 38 def request_id @request_id end |
#status ⇒ Float
The HTTP status code associated with the error. This will only be returned in the response body when the error information is provided via a webhook.
51 52 53 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 51 def status @status end |
#suggested_action ⇒ String
Suggested steps for resolving the error
60 61 62 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 60 def suggested_action @suggested_action end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
101 102 103 104 105 106 107 108 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 101 def inspect class_name = self.class.name.split('::').last "<#{class_name} error_type: #{@error_type.inspect}, error_code: #{@error_code.inspect},"\ " error_message: #{@error_message.inspect}, display_message: #{@display_message.inspect},"\ " request_id: #{@request_id.inspect}, causes: #{@causes.inspect}, status:"\ " #{@status.inspect}, documentation_url: #{@documentation_url.inspect}, suggested_action:"\ " #{@suggested_action.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 96 97 98 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 92 def to_s class_name = self.class.name.split('::').last "<#{class_name} error_type: #{@error_type}, error_code: #{@error_code}, error_message:"\ " #{@error_message}, display_message: #{@display_message}, request_id: #{@request_id},"\ " causes: #{@causes}, status: #{@status}, documentation_url: #{@documentation_url},"\ " suggested_action: #{@suggested_action}>" end |
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/plaid/exceptions/error_error_exception.rb', line 74 def unbox(hash) return nil unless hash @error_type = hash.key?('error_type') ? hash['error_type'] : nil @error_code = hash.key?('error_code') ? hash['error_code'] : nil @error_message = hash.key?('error_message') ? hash['error_message'] : nil @display_message = hash.key?('display_message') ? hash['display_message'] : nil @request_id = hash.key?('request_id') ? hash['request_id'] : SKIP @causes = hash.key?('causes') ? hash['causes'] : SKIP @status = hash.key?('status') ? hash['status'] : SKIP @documentation_url = hash.key?('documentation_url') ? hash['documentation_url'] : SKIP @suggested_action = hash.key?('suggested_action') ? hash['suggested_action'] : SKIP end |