CloudConnect Transformation Language also provides a simple mechanism for catching and handling possible errors.
As the first step, a string variable must be declared:
string MyException;
After that, in the code of your transformation, you can use the following try-catch
statement:
try Statement1 catch(MyException) [Statement2]
If Statement1
(a simple statement or a block of statements) is executed successfully, the graph does not fail and the processing continues.
On the other hand, if Statement1
fails, an exception is thrown and assigned to the MyException
variable.
The MyException
variable can be printed or managed other way.
Once the exception is thrown, graph fails unless another Statement2
(which fixes the failed Statement1
) is executed.
In addition to it, since version 3.0 of CloudConnect,
CTL1 uses a set of optional OnError()
functions that
exist to each required transformation function.
For example, for required functions (e.g., append()
, transform()
, etc.),
there exist following optional functions:
appendOnError()
, transformOnError()
, etc.
Each of these required functions may have its (optional) couterpart
whose name differs from the original (required) by adding the OnError
suffix.
Moreover, every <required ctl template function>OnError()
function
returns the same values as the original required function.
This way, any exception that is thrown by the original required function causes call of
its <required ctl template function>OnError()
counterpart
(e.g., transform()
fail may call transformOnError()
, etc.).
In this transformOnError()
, any incorrect code can be fixed,
error message can be printed to Console, etc.
Important | |
---|---|
Remember that these If you want that some |