ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Accessing the ExceptionList values in Handler scope

Post new topic  Reply to topic Goto page 1, 2  Next
 Accessing the ExceptionList values in Handler scope « View previous topic :: View next topic » 
Author Message
rel
PostPosted: Thu Jan 10, 2013 3:10 am    Post subject: Accessing the ExceptionList values in Handler scope Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Thu Jan 10, 2013 8:46 am    Post subject: Reply with quote

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
View user's profile Send private message
lancelotlinc
PostPosted: Thu Jan 10, 2013 9:36 am    Post subject: Re: Accessing the ExceptionList values in Handler scope Reply with quote

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
View user's profile Send private message Send e-mail
kash3338
PostPosted: Thu Jan 10, 2013 10:04 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Hope these links helps,

DECLARE HANDLER statement

SQLSTATE function

Quote:

SqlState = 'S22012'
Divide by zero. A divide operation whose result data type has no concept of infinity had a zero right operand.
Back to top
View user's profile Send private message Send e-mail
rel
PostPosted: Tue Jan 15, 2013 11:44 pm    Post subject: Reply with quote

Novice

Joined: 10 Jan 2013
Posts: 11

[quote="kash3338"]Hope these links helps,

DECLARE HANDLER statement

SQLSTATE function

No they don't. Sorry.

Any other thoughts?
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Jan 16, 2013 12:38 am    Post subject: Reply with quote

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
View user's profile Send private message
rel
PostPosted: Wed Jan 16, 2013 12:44 am    Post subject: Reply with quote

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
View user's profile Send private message
rekarm01
PostPosted: Wed Jan 16, 2013 12:52 am    Post subject: Reply with quote

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
View user's profile Send private message
marko.pitkanen
PostPosted: Wed Jan 16, 2013 1:11 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
rel
PostPosted: Wed Jan 16, 2013 1:14 am    Post subject: Reply with quote

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
View user's profile Send private message
smdavies99
PostPosted: Wed Jan 16, 2013 1:38 am    Post subject: Reply with quote

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
View user's profile Send private message
kash3338
PostPosted: Wed Jan 16, 2013 5:08 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

rel wrote:
kash3338 wrote:
Hope these links helps,

DECLARE HANDLER statement

SQLSTATE function


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
View user's profile Send private message Send e-mail
rel
PostPosted: Wed Jan 16, 2013 5:13 am    Post subject: Actual Problem Reply with quote

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
View user's profile Send private message
kash3338
PostPosted: Wed Jan 16, 2013 5:26 am    Post subject: Re: Actual Problem Reply with quote

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
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Wed Jan 16, 2013 5:43 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Accessing the ExceptionList values in Handler scope
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.