Error Handling

When task processing fails, it is the responsibility of the task to report to the Services Framework that an error occurred. To report an error, the task must issue a TaskProcessingException to the Services Framework.
public CompleteStatus runTask() throws TaskProcessingException
Every error must be caught by the task and properly translated in a TaskProcessingException. When the Services Framework receives a TaskProcessingException, the status of the activity record is set to error and the getMessage() information from the TaskProcessingException is stored in the database. The message from the TaskProcessingException is visible in the user interface and provides details about why the task failed.
Note: Issuing a TaskProcessingException is the only way the activity record for the task can be set to error by the Services Framework. The task should provide a detailed description of the error.