Class: ThePlaidApi::ErrorErrorException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- ThePlaidApi::ErrorErrorException
- Defined in:
- lib/the_plaid_api/exceptions/error_error_exception.rb
Overview
Errors are identified by ‘error_code` and categorized by `error_type`. Use these in preference to HTTP status codes to identify and handle specific errors. HTTP status codes are set and provide the broadest categorization of errors: 4xx codes are for developer- or user-related errors, and 5xx codes are for Plaid-related errors, and the status will be 2xx in non-error cases. An Item with a non-`null` error object will only be part of an API response when calling `/item/get` to view Item status. Otherwise, error fields will be `null` if no error has occurred; if an error has occurred, an error code will be returned instead.
Instance Attribute Summary collapse
-
#causes ⇒ Array[Object]
In this 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_code_reason ⇒ String
The specific reason for the error code.
-
#error_message ⇒ String
A developer-friendly representation of the error code.
-
#error_type ⇒ PlaidErrorType
A broad categorization of the error.
-
#provided_account_subtypes ⇒ Array[String]
A list of the account subtypes that were extracted but did not match the requested subtypes via the ‘account_filters` parameter in `/link/token/create`.
-
#request_id ⇒ String
A unique ID identifying the request, to be used for troubleshooting purposes.
-
#required_account_subtypes ⇒ Array[String]
A list of the account subtypes that were requested via the ‘account_filters` parameter in `/link/token/create`.
-
#status ⇒ Integer
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.
98 99 100 101 102 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 98 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#causes ⇒ Array[Object]
In this 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 be provided for the `error_type` `ASSET_REPORT_ERROR` or `CHECK_REPORT_ERROR`. `causes` will also not be populated inside an error nested within a `warning` object.
65 66 67 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 65 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.
50 51 52 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 50 def @display_message end |
#documentation_url ⇒ String
The URL of a Plaid documentation page with more information about the error
75 76 77 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 75 def documentation_url @documentation_url end |
#error_code ⇒ String
The particular error code. Safe for programmatic use.
26 27 28 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 26 def error_code @error_code end |
#error_code_reason ⇒ String
The specific reason for the error code. Currently, reasons are only supported OAuth-based item errors; ‘null` will be returned otherwise. Safe for programmatic use. Possible values: `OAUTH_INVALID_TOKEN`: The user’s OAuth connection to this institution has been invalidated. `OAUTH_CONSENT_EXPIRED`: The user’s access consent for this OAuth connection to this institution has expired. ‘OAUTH_USER_REVOKED`: The user’s OAuth connection to this institution is invalid because the user revoked their connection.
39 40 41 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 39 def error_code_reason @error_code_reason end |
#error_message ⇒ String
A developer-friendly representation of the error code. This may change over time and is not safe for programmatic use.
44 45 46 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 44 def @error_message end |
#error_type ⇒ PlaidErrorType
A broad categorization of the error. Safe for programmatic use.
22 23 24 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 22 def error_type @error_type end |
#provided_account_subtypes ⇒ Array[String]
A list of the account subtypes that were extracted but did not match the requested subtypes via the ‘account_filters` parameter in `/link/token/create`. Currently only populated for `NO_ACCOUNTS` errors from Items with `investments_auth` as an enabled product.
93 94 95 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 93 def provided_account_subtypes @provided_account_subtypes 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.
55 56 57 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 55 def request_id @request_id end |
#required_account_subtypes ⇒ Array[String]
A list of the account subtypes that were requested via the ‘account_filters` parameter in `/link/token/create`. Currently only populated for `NO_ACCOUNTS` errors from Items with `investments_auth` as an enabled product.
86 87 88 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 86 def required_account_subtypes @required_account_subtypes end |
#status ⇒ Integer
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.
70 71 72 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 70 def status @status end |
#suggested_action ⇒ String
Suggested steps for resolving the error
79 80 81 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 79 def suggested_action @suggested_action end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 142 def inspect class_name = self.class.name.split('::').last "<#{class_name} error_type: #{@error_type.inspect}, error_code: #{@error_code.inspect},"\ " error_code_reason: #{@error_code_reason.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}, required_account_subtypes:"\ " #{@required_account_subtypes.inspect}, provided_account_subtypes:"\ " #{@provided_account_subtypes.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
131 132 133 134 135 136 137 138 139 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 131 def to_s class_name = self.class.name.split('::').last "<#{class_name} error_type: #{@error_type}, error_code: #{@error_code}, error_code_reason:"\ " #{@error_code_reason}, error_message: #{@error_message}, display_message:"\ " #{@display_message}, request_id: #{@request_id}, causes: #{@causes}, status: #{@status},"\ " documentation_url: #{@documentation_url}, suggested_action: #{@suggested_action},"\ " required_account_subtypes: #{@required_account_subtypes}, provided_account_subtypes:"\ " #{@provided_account_subtypes}>" end |
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/the_plaid_api/exceptions/error_error_exception.rb', line 107 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_code_reason = hash.key?('error_code_reason') ? hash['error_code_reason'] : SKIP @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 @required_account_subtypes = hash.key?('required_account_subtypes') ? hash['required_account_subtypes'] : SKIP @provided_account_subtypes = hash.key?('provided_account_subtypes') ? hash['provided_account_subtypes'] : SKIP end |