+ Start a Discussion
SuperfellSuperfell 

Error Structures

Errors are always reported with an http status code, and an standardized error formated payload, the status codes used vary based on the best match to the HTTP definitions, mostly for errors you're going to see 4xx or possibly a 500 status code.

 

The error payload itself is always an array of errors, each error has a message, errorCode and optional fields array as properties. e.g.

 

 

< HTTP/1.1 400 Bad Request
< Server: 
< Content-Type: application/json; charset=UTF-8
< Content-Length: 360
< Date: Thu, 02 Sep 2010 03:20:49 GMT
< 
[ {
  "message" : "\nselect id,name,type from accountx\n                         ^\nERROR at Row:1:Column:26\nsObject type 'accountx' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.",
  "errorCode" : "INVALID_TYPE"
} ]

 

 

for XML formatted responses, you get an out Errors element, and an inner Error element for each error, e.g.

 

 

< HTTP/1.1 400 Bad Request
< Server: 
< Content-Type: application/xml; charset=UTF-8
< Content-Length: 475
< Date: Thu, 02 Sep 2010 03:24:24 GMT
< 
<?xml version="1.0" encoding="UTF-8"?>
<Errors>
    <Error>
        <errorCode>INVALID_TYPE</errorCode>
        <message>
select id,name,type from accountx
                         ^
ERROR at Row:1:Column:26
sObject type &apos;accountx&apos; is not supported. If you are attempting to use a custom object, be sure to append the &apos;__c&apos; after the entity name. Please reference your WSDL or the describe call for the appropriate names.</message>
    </Error>
</Errors>