Author |
Message
|
pvemuri |
Posted: Fri Jan 07, 2005 11:32 am Post subject: Parsing Exception Message |
|
|
 Voyager
Joined: 05 Jan 2004 Posts: 83 Location: CA, USA
|
Hello all,
We have to parse the Exception message that come out of our Catch trminal of the Try catch node. Our error message needs to contain :
1. WBI error code
2. Error text. (reason for error / exception)
3. The node where the error occured.
I am able to get the above mentioned 3 components. But, I dont feel that my code gets enough information. (atleast interms of error text)
Can some one post any ESQL code that is used to parse the exception list and generate some informative error message.
Thanks,
Pvemuri. |
|
Back to top |
|
 |
Nizam |
Posted: Fri Jan 07, 2005 1:08 pm Post subject: |
|
|
Disciple
Joined: 10 Feb 2004 Posts: 160
|
pvemuri,
Use the visual debugger to see what is coming out of your catch terminal.
Expand the Exception list to know where the information you need is in the tree.
Then you can write your own code very easily. |
|
Back to top |
|
 |
JT |
Posted: Fri Jan 07, 2005 5:16 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
You might also consider extracting the Inserts from the ExceptionList tree, as they provide details regarding the error. The Inserts supply the values that are identified in the descrption of the BIP error.
Sample code to parse the ExceptionList is provided in the Toolkit Help facility. Click here |
|
Back to top |
|
 |
kirani |
Posted: Sat Jan 08, 2005 4:59 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Can you post your code here? _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
pvemuri |
Posted: Sun Jan 09, 2005 3:54 pm Post subject: |
|
|
 Voyager
Joined: 05 Jan 2004 Posts: 83 Location: CA, USA
|
Kiran.
I am using the same code provided in the Info center to grab the label number and error number.
Code: |
-- Declare variable for the Error number extracted from exception list
DECLARE Error INTEGER;
-- Declare current path within the exception list
DECLARE Path CHARACTER;
-- Start at first child of exception list
SET Path = 'InputExceptionList.*[1]';
-- Loop until no more children
WHILE EVAL( 'FIELDNAME(' || Path || ') IS NOT NULL' ) DO
-- Check if error number is available
IF EVAL( 'FIELDNAME(' || Path || '.Number) IS NOT NULL' ) THEN
-- Record only the deepest error number
SET Error = EVAL( Path || '.Number' );
END IF;
-- Step to last child of current element (usually a nested exception list
SET Path = Path || '.*[<]';
END WHILE; |
Where as, I am trying to enhance my code so that It contains more detailed info. I am just curious if any one has developed a code taht captures more info and is more efficient. For example; My code captures the Label of the node where the error occurs and the error text.
The error text I am grabbing is the deepest "Text" field (non -null) in the exception list tree. But the other "Text" fields also provide some more useful info. But I just cannot grab all the "text" fields and append them into a single string (may be that will llok like Junk). All I want to know is , whether there is a pattern in the exception list where I can look for some particular fields.
Thanks,
Pvemuri. |
|
Back to top |
|
 |
Nizam |
Posted: Sun Jan 09, 2005 6:25 pm Post subject: |
|
|
Disciple
Joined: 10 Feb 2004 Posts: 160
|
pvemuri,
All the information about your exceptions that occured will be formatted in the exception list tree. You have to decide on your requirements for what to capture and format when an exception occurs.
I would suggest you to test your flows for all possible cases that can cause exceptions and see where the exception occurs. See what is set in the exception tree and know why the exception occurs.
If you already know what do when an exception occurs, post it here and somebody would help you.
Nyzam. |
|
Back to top |
|
 |
|