API XML Error
A FreeDESK XML error will contain an error code and textual description.
<error> <code>XXXX</code> <text>Textual Error Description</text> </error>
The following is a list of in-built error codes based upon the ErrorCode class. You may use your own error codes which can either be captured by your own receipt handling code or will be detected client-side with the DESK.isError(xml) call.
Login has failed
Attempt to validate client SID has failed as it has expired (or has been deleted, or is illegal)
The API has been called with an unknown or unregistered mode
An error has occurred when fetching/searching/writing an entity. The system logs will provide more information.
Current user context does not have access to the mode or resource requested
A resource was asked for that does not exist or has not been registered
A request has been received of a type which is unknown or unregistered
Generic failure, the operation requested has failed. Used to indicate a general call failure of an API call for some unknown reason.
Creating Custom Errors
To create a custom error use the FreeDESK_Error class as follows:
// Our error information $code = 999; $text = "An Error"; // Create a FreeDESK_Error $myError = new FreeDESK_Error($code, $text); // Output the XML echo $myError->XML(); // n.b. this will output XML without header // $myError->XML(true) will include an XML header