Exception Handling
Exception Handling
Exceptions can be surfaced from either the API or the CData ADO.NET Provider for Salesforce. Each exception will have an error code, an error message, and a SQL state.
Error Codes
The error code classifies the type of error.
| 0 | NONE | Used for unclassified errors and internally handled errors. This code also covers data source-specific errors that do not fit in any specific category. | |
| 65537 | TCP_UNKNOWN_HOST | Unable to resolve a hostname (DNS failure). | |
| 65538 | TCP_CONNECTION_REFUSED | Could not connect to the remote port. | |
| 65539 | TCP_AUTH_FAILED | Login failed when using a binary authentication protocol. Use this for auth errors when the protocol is not HTTP (LDAP, SASL, Kerberos, ...). | |
| 65540 | TCP_TIMEOUT | Did not receive a response after sending a request to the server. | |
| 65541 | TCP_PROTOCOL | For wire protocol drivers. Either the server sent a bad packet that we are unable to process, or we cannot construct a packet to send. | |
| 131073 | TLS_SERVER_UNTRUSTED | Could not verify SSL server certificate. | |
| 131074 | TLS_CLIENT_UNTRUSTED | Server did not accept the client certificate we sent. | |
| 196609 | OAUTH_DECRYPT_FAILED | OAuthEncryptKey did not decrypt the OAuthSettings file. | |
| 196610 | OAUTH_MISSING_CLIENT_INFO | OAuthClientId / OAuthClientSecret / OAuthJWTCert is missing. | |
| 196611 | OAUTH_MISSING_PROP | General OAuth property missing. OAUTH_MISSING_CLIENT_INFO is used for missing client ID/secret and JWT cert. | |
| 196612 | OAUTH_NO_ACCESS_TOKEN | Unable to retrieve access token. Only use this when getting a token in GetOAuthAccessToken / RefreshOAuthAccessToken. | |
| 196613 | OAUTH_TOKEN_EXPIRED | The access token expired. Normally used with a RefreshOAuth/OAuthException behavior. | |
| 196614 | OAUTH_INVALID_PROP | OAuth property has an invalid value. OAUTH_MISSING_CLIENT_INFO / OAUTH_MISSING_PROP is used if the value is not set. | |
| 262145 | HTTP_REQUEST_TIMEOUT | Did not receive a response from the HTTP server. | |
| 262146 | HTTP_CLIENT_ERROR | Generic HTTP 4xx error. Only use for 4xx errors not covered by other codes. | |
| 262147 | HTTP_AUTH_FAILED | HTTP 401 error. | |
| 262148 | HTTP_LIMIT_EXCEEDED | HTTP 429 error. | |
| 262149 | HTTP_SERVER_ERROR | HTTP 5xx error. | |
| 262150 | HTTP_NOT_FOUND_ERROR | HTTP 404 error. | |
| 327681 | CORE_TIMEOUT | General timeout. Not related to a specific network request. | |
| 327682 | CORE_OP_NOT_ALLOWED | Operation blocked by provider permissions. | |
| 327683 | CORE_CONNECTION_CONFIG | Connection configuration is not valid. | |
| 327684 | CORE_SERIALIZE | Failed to encode data into a specific format (XML, JSON, CSV, ...). | |
| 327685 | CORE_DESERIALIZE | Failed to decode data from a specific format (XML, JSON, CSV, ...). | |
| 393217 | SQL_SYNTAX_ERROR | Unable to parse a SQL query. | |
| 393218 | SQL_MISSING_COLUMNS | Query did not include required columns. | |
| 393219 | SQL_MISSING_PARAMS | Stored procedure call did not include required parameters. | |
| 393220 | SQL_QUERY_NOT_SUPPORTED | A part of the query is not allowed in the current context. | |
| 458753 | SSH_SERVER_UNTRUSTED | Could not verify SSH server. | |
| 524289 | STORAGE_LIST_EXCEPTION | Issue listing storage resources. | |
| 524290 | STORAGE_RESOURCE_NOT_FOUND | Issue finding storage resources. | |
| 524291 | STORAGE_ROOT_RESOURCE_NOT_FOUND | The root resource (bucket/share/drive) was not found; cannot create it in flat file drivers. | |
| 524292 | STORAGE_RESOURCE_NOT_A_DIRECTORY | Storage resource is not a directory. | |
| 524293 | STORAGE_RESOURCE_NOT_A_FILE | Storage resource is not a file. | |
| 524294 | STORAGE_PERMISSIONS_DENIED | Storage permissions denied. |
SQL State
The SQL state is used when throwing generic provider errors to the wrapper and indicates the success or failure of a call.
Some of the common SQL states are listed below:
| 07007 | REQUIRED_CLAUSE | Class Code 07: Dynamic SQL Error. | |
| 08001 | OPEN_CONNECTION | Class Code 08: Connection Exception. The connection was unable to be established to the application server or other server. | |
| 08004 | REJECT_CONNECTION | The application server rejected establishment of the connection. | |
| 42501 | PRIVILEGE_IDENTIFIED_OBJECT | Class Code 42: Syntax Error or Access Rule Violation. The authorization ID does not have the privilege to perform the specified operation on the identified object. | |
| 42506 | AUTH_FAILED | Owner authorization failure occurred. | |
| 42601 | SQL_SYNTAX | A character, token, or clause is invalid or missing. |
Error Message
The error message provides more detailed reasoning about why the error occurred. It provides an explanation of the issue, and may include steps on how to resolve it.