Groovy error handling and reporting

   Exchange Pre-configured Maestro services.  |   Platform Developer |  All versions   This feature is related to v5.1 and higher.

There are two main types of errors that occur in Groovy service execution:

  • Data Error: An issue was identified with some of the data provided to the service. Usually, this is a recoverable error that can be handled by the Groovy service or, in the case of dynamic data services, reported to the user such that they may resolve the issue and try again. Examples may be that not enough information was provided or there was a format validation error with some of the data (for example, an invalid Social Security Number). Generally, it is best if these errors are intercepted before the service is called (for example, in the form validation logic) to avoid these service level data errors.
  • System Error: An unrecoverable error was received and the execution of the service failed. This type of error is commonly encountered when performing integrations with third-party services. It is important that these errors are logged to the System Error log or Event Log such that the Temenos Journey Manager system monitoring service picks them up and generate alerts.

Handling of these errors in Groovy code should usually include error type information in the service response so that the consumer may handle the situation appropriately. For system errors, it is best not to provide any detailed messaging in the response as this may create security concerns. For data errors, some additional information about the nature of the error is often useful. For example:

Data Error
{
    "verifyStatus": "UNVERIFIED",
    "executionStatus": "DATA_ERROR",
    "errorMessage": "Value of [someone@somewhere] for email is invalid"
}
System Error
{
    "verifyStatus": "UNVERIFIED",
    "executionStatus": "SYSTEM_ERROR",
}