Error Handling

The API calls return error data that your client application can use to identify and resolve runtime errors.

If an error occurs during the invocation of most API calls, then the API provides these types of error handling.

  • For errors resulting from badly formed messages, failed authentication, or similar problems, the API returns a SOAP fault message with an associated ExceptionCode.
  • For most calls, if the error occurs because of a problem specific to the query, the API returns an Error. For example, if a create() request contains more than 200 objects.

Error Handling for Session Expiration

When you sign on via the login() call, a new client session begins and a corresponding unique session ID is generated. Sessions expire automatically after a predetermined length of inactivity, which can be configured in Salesforce from Setup by clicking Security Controls. The default is 120 minutes (two hours). If you make an API call, the inactivity timer is reset to zero.

When your session expires, the exception code INVALID_SESSION_ID is returned. If this code is returned, you must invoke the login() call again.

More About Error Handling

For more information about errors, see these topics.