Author |
Message
|
rel |
Posted: Thu Jan 10, 2013 3:10 am Post subject: Accessing the ExceptionList values in Handler scope |
|
|
 Novice
Joined: 10 Jan 2013 Posts: 11
|
Hi
Does anyone know if ther is a way to access an exception details cought by DECLATE HANDLER (non DB exception), for as deviding by zero?  |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 10, 2013 8:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Perhaps the exception details are in scope within the handler somehow? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Jan 10, 2013 9:36 am Post subject: Re: Accessing the ExceptionList values in Handler scope |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
rel wrote: |
Hi
Does anyone know if ther is a way to access an exception details cought by DECLATE HANDLER (non DB exception), for as deviding by zero?  |
Yes. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
kash3338 |
Posted: Thu Jan 10, 2013 10:04 am Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
|
Back to top |
|
 |
rel |
Posted: Tue Jan 15, 2013 11:44 pm Post subject: |
|
|
 Novice
Joined: 10 Jan 2013 Posts: 11
|
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Jan 16, 2013 12:38 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
Within the scope of a declared handler, the only information available about any errors is what's provided by the ESQL database state functions.
Within the scope of a Catch or Failure flow, additional information about any errors is available in the ExceptionList tree. |
|
Back to top |
|
 |
rel |
Posted: Wed Jan 16, 2013 12:44 am Post subject: |
|
|
 Novice
Joined: 10 Jan 2013 Posts: 11
|
rekarm01 wrote: |
Within the scope of a declared handler, the only information available about any errors is what's provided by the ESQL database state functions.
Within the scope of a Catch or Failure flow, additional information about any errors is available in the ExceptionList tree. |
Thank you,
My problem is I need to handle the exception inside a LOOP in esql code, and not in the flow with try-catch node/Failure terminal.  |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Jan 16, 2013 12:52 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
rel wrote: |
My problem is I need to handle the exception inside a LOOP in esql code |
Which error(s) does the loop need to handle, and how does it need to handle them? The SQLSTATE function supports several different categories of errors, aside from database errors, including user-defined errors. |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Wed Jan 16, 2013 1:11 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi rel,
I think you need to reread, try and rethink how "DECLARE HANDLER statement" works. I'm not sure but I'm remembering that in side the HANDLER you can access only the SQLSTATE and other special registers to find out what was the exception that was captured.
--
Marko |
|
Back to top |
|
 |
rel |
Posted: Wed Jan 16, 2013 1:14 am Post subject: |
|
|
 Novice
Joined: 10 Jan 2013 Posts: 11
|
rekarm01 wrote: |
rel wrote: |
My problem is I need to handle the exception inside a LOOP in esql code |
Which error(s) does the loop need to handle, and how does it need to handle them? The SQLSTATE function supports several different categories of errors, aside from database errors, including user-defined errors. |
In my case I need to catch an exception when trying to send mail with invalid address. The scope catches the error, but SQLSTATE is empty.
regards, |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Jan 16, 2013 1:38 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
[quote="rel"]
rekarm01 wrote: |
In my case I need to catch an exception when trying to send mail with invalid address. The scope catches the error, but SQLSTATE is empty.
|
Sounds like time for a PMR then?
That way you will get an official explanation at to the behaviour and if it is a genuine falut, you will get a fix for it. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jan 16, 2013 5:08 am Post subject: |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
rel wrote: |
No they don't. Sorry.
Any other thoughts? |
How have you implemented this in your compute node? Did you try clearing the "Throw exception on database error" in your compute node and try setting the SQLSTATE VALUE 'S22012'?
Did your code look something like this,
Code: |
WHILE .... DO
DECLARE EXIT HANDLER FOR SQLSTATE VALUE 'S22012'
BEGIN
SET OutputRoot.XMLNSC.ERROR.mySQLCODE = SQLCODE;
SET OutputRoot.XMLNSC.ERROR.mySQLSTATE = SQLSTATE;
SET OutputRoot.XMLNSC.ERROR.mySQLNATIVEERROR = SQLNATIVEERROR;
SET OutputRoot.XMLNSC.ERROR.mySQLERRORTEXT = SQLERRORTEXT;
...
END;
...
END WHILE;
|
Can you please tell us the actual problem you are facing with this?
Last edited by kash3338 on Wed Jan 16, 2013 5:14 am; edited 1 time in total |
|
Back to top |
|
 |
rel |
Posted: Wed Jan 16, 2013 5:13 am Post subject: Actual Problem |
|
|
 Novice
Joined: 10 Jan 2013 Posts: 11
|
Hi
I'm looping for each node I have in the message, processing it and propagating it to 'out1' to an EmailOutput Node.
The Handler scope catches any problem in the loop, including problems when sending the mail out. So if the smtp server is down or the email address is invalid I want to catch it.
Thanks ahead for trying to help |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jan 16, 2013 5:26 am Post subject: Re: Actual Problem |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
rel wrote: |
I'm looping for each node I have in the message, processing it and propagating it to 'out1' to an EmailOutput Node.
The Handler scope catches any problem in the loop, including problems when sending the mail out. So if the smtp server is down or the email address is invalid I want to catch it. |
Now this is more clear. Hope you also had a look at this quote in the documentation (for which the link is mentioned above),
Quote: |
Handling errors in other nodes
Exceptions that occur in other nodes (that is, downstream of a PROPAGATE statement) might be caught by handlers in the normal way. Handling such errors intelligently, however, poses a problem: another node was involved in the original error, therefore another node, and not necessarily the originator of the exception, is likely to be involved in handling the error.
To help in these situations, the Database and Compute nodes have four terminals called Out1, Out2, Out3, and Out4. In addition, the syntax of the PROPAGATE statement includes target expression, message source, and control clauses to give more control over these terminals. |
Other option, why not use a try/catch after your compute for the the exceptions to be caught during propagation and the HANDLER for exceptions that occur in your code. Not sure on this design though, may be the experts can advise on this. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jan 16, 2013 5:43 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
In order for a handler to process exceptions that occur downstream of the compute node that they are coded in, you need to explicitly propagate from within the scope the handler covers.
You can't just declare a handler and then RETURN TRUE to the best of my knowledge (mgk will be along shortly to correct me.... ) |
|
Back to top |
|
 |
|