Catch Exceptions

In the Catch block we encounter two different scenarios:

  • a controlled exception has been caught or

  • an uncontrolled exception has been caught.

We want to treat both situations equally in the catch block.

  1. Set DDP_TryCatchMessage = Document Property - Base - Try/Catch Message

  2. Use the created Dynamic Document Properties to handle the Exception.

Create a j.Error.RESponse message as the result of an Exception

Exception Base Class

In case of an uncontrolled exception, the script passes through the Try/Catch Message in DDP_rootCause=DDP_TryCatchMessage. The property name is fix, and that is why you user-defined exception messages should contain a "rootCause" element, so that you can access the error message through that property, no matter if the exception was controlled or uncontrolled.

DDP_userMessage is set to "Something went wrong! Please contact your admin!".

The ParseExceptionMessage Script

Source Code on GitHub

Last updated