Error Handling

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

Metadata API provides these types of error handling.

  • Since the Metadata API uses the enterprise or partner WSDLs to authenticate, it uses SOAP fault messages defined in those WSDLs for errors resulting from badly formed messages, failed authentication, or similar problems. Each SOAP fault has an associated ExceptionCode. For more details, see Error Handling in the SOAP API Developer Guide.
  • For errors with the asynchronous create(), update(), and delete() calls, see the error status code in the statusCode field in the AsyncResult object for the associated component.
  • For errors with the synchronous CRUD calls, see the error status code in the statusCode field of the Error object corresponding to each error in the array returned by the errors field of the appropriate result object. For example, the result object of createMetadata() is SaveResult.
  • For errors with deploy(), see the problem and success fields in the DeployMessage object for the associated component.
  • For errors with retrieve(), see the problem field in the RetrieveMessage object for the associated component.

For sample code, see Step 3: Walk Through the Java Sample Code.