In my Enterprise Integrator, Integration Component, I am putting the entire flowchart in a Try path, because I want to handle all the exceptions in a generic way – printing the error message and input record to a logfile.
However, when I put my flowchart in the Try path, error message normally shows in the Trace log do not show anymore. I believe I need to print the error message myself in a Custom Step. But I don’t know how I can access the error message. Is it accessible in form of a environment variable or something?
Here is the code I want to put in my Custom step, where error_message is the EI built-in variable that contains the error_message (I assume).
Systme.out.println(“Error =” + error_message);
Can someone please tell me what I should put in the place or error_message?
The following is the code from ERROR CATCH I used to get the error text.
try {
AdapterOperationStep();
CustomerCodeStep();
DeliverAcknowledgement();
ErrorCatchStepTry();
}
catch (AdapterException ErrorCatchStepEx) {
declarationStep.stringExceptionMessage = ErrorCatchStepEx.getLocalizedMessage();
declarationStep.$strExceptionMsg = true;
publishErrorNotify();
DeliverError();
ErrorCatchStepCatch();
}
The line:
declarationStep.stringExceptionMessage = ErrorCatchStepEx.getLocalizedMessage();
will catch error text. Then, you can print declarationStep.stringExceptionMessage using access.println().
I hope this will help you.
ZG
We use another method (requires some Java hacking) to get access to the Exception:
In the IC Java script:
Define a variable: String myException = “”;
First line after catch: myException = catchEx.toString();
Make a custom code step in the catch step that takes no input and has a String as output. In the code do something like:
out.grabbedException = myException;
return out;
Then you can map the output of the custom step to whatever you want (e.g. a trace step or an error output document).