Author |
Message
|
LH33 |
Posted: Wed Feb 04, 2004 2:39 pm Post subject: Multiple User Exceptions |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
I have a message flow that checks for several different values on input transactions. I need to format an error message for each value that is invalid. I have an error "sub-flow" that formats a message and writes it to an error queue to be logged when I throw a user exception. How can I get an error for each failed condition?
For example: If the first value is invalid, the user exception is thrown, the node is exited and the error sub-flow is called and no other conditions are checked.
Here is a sample of the code that checks for the conditions and throws the user exception:
My input value for FIL1 is 'TR' and my input value for CONDSTATUS is 1.
How can I get two error messages to be produced - one for FIL1 and one for CONDSTATUS?
Thanks!! Lisa
CODE:
IF FIL1 <> 'TR' THEN
Throw user exception values ('Invalid Work Queue Allocation sent from System.") ;
END IF;
IF CONDSTATUS = 1
THEN
Throw user exception values ('Power clue does not reflect condition status');
END IF; |
|
Back to top |
|
 |
Missam |
Posted: Wed Feb 04, 2004 2:57 pm Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
All You need is to generate two different test cases for each failure and test it individually.
When a message encounters an exception it stops processing and go to error handler,so there is no way that you can encounter two user exceptions at a time. |
|
Back to top |
|
 |
LH33 |
Posted: Wed Feb 04, 2004 3:06 pm Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
Can you post an example of what you mean?
Thanks, Lisa |
|
Back to top |
|
 |
EddieA |
Posted: Wed Feb 04, 2004 3:09 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
You would have to do all of your checks first, keeping the status of each one internally. (In the LocalEnvironment) ??. Then at the end, see if you had any errors. If so, then build your THROW that lists all the errors you found.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
Missam |
Posted: Wed Feb 04, 2004 7:31 pm Post subject: |
|
|
Chevalier
Joined: 16 Oct 2003 Posts: 424
|
What Eddie said is correct,you need to hold all your exception messages in a local environment and throw it all at the end,
you can do like this,
IF FIL1 <> 'TR' THEN
Set OutputLocalEnvironment.Errors.InvalidQueue ='Invalid Work Queue Allocation sent from System' ;
END IF;
IF CONDSTATUS = 1
THEN
Set OutputLocalEnvironment.Errors.Powerclue='Power clue does not reflect condition status';
END IF;
and at the end check the cardinality
IF CARDINALITY(OutputLocalEnvironment.Errors.*[] > 0) THEN
concatinate all the errors in local environment here and throw user exception below
END IF; |
|
Back to top |
|
 |
LH33 |
Posted: Thu Feb 05, 2004 5:13 am Post subject: |
|
|
Master
Joined: 21 Nov 2002 Posts: 200
|
|
Back to top |
|
 |
|