Exception Handling Pattern
Get your hands on it
Last updated
Get your hands on it
Last updated
Basically, there are two different types of exceptions:
Uncontrolled exceptions (Exception)
Thrown, for example, by a connector where you have no control over the message or format of that exception. For example, connection time-out.
Controlled exceptions (ApplicationException)
Thrown by your code - controlled exception.
Uncontrolled exceptions are thrown by the platform or a connector and there is not much you can do. In your Catch-Block you get a Try/Catch Message and you have to deal with it.
Uncontrolled exceptions normally contain (English) technical messages that generally cannot or must not be passed on to the user. We refer to such messages below as the rootCause
of the exception. The root-cause of an exception is only stored internally by Boomi, for example in the log.
A (localised) error message for the user, which we refer to as a userMessage
, could be: "An error has occurred. Please contact your admin".
rootCause
is the technical error message that is not shown to the user.
userMessage
is a (localised) message to the user.
The idea of retaining control over exceptions is to give the exception message some (Json) structure. With structured exception messages, we are able to react specifically to the various exceptions in the catch block. Controlled exceptions are thrown by your code (Exception Shape), and you can decide what to put in the exception message.
Let's look a bit closer at user-defined exception messages.