IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
Expand all | Collapse all

How to access the error message in Catch?

  • 1.  How to access the error message in Catch?

    Posted Sun June 16, 2002 12:49 PM

    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?


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 2.  RE: How to access the error message in Catch?

    Posted Mon June 17, 2002 10:28 AM

    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


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods


  • 3.  RE: How to access the error message in Catch?

    Posted Mon June 17, 2002 11:59 AM

    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).


    #Integration-Server-and-ESB
    #webMethods-General
    #webMethods