ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bhaarat Sharma <bhaara...@gmail.com>
Subject how to do error handling?
Date Thu, 30 Jul 2009 22:06:16 GMT
Hi guys,
I have a few questions on how to handle errors that are thrown when iBatis
calls the Stored Procedures.

Assuming i have the following code:

results_list = getSqlMapClientTemplate().queryForList("spfile.getReport",

If i have the above code then when error occurs, we see it on the screen and
it looks very ugly. Also, if the error occurs in above line then code after
this line is not executed.  I wish to catch the error, put it in the log
file and show user a page that something bad has happened.

So I changed the above code to:
        try {
            results_list =
getSqlMapClientTemplate().queryForList("spfile.getReport", parmMap);
        catch (Exception e)

this catches the error fine. BUT the problem is that, since I am catch the
error, the code after the above call is also being executed.  Which I do not
want.  If the error occurs in the above call then I don't want any further
code to get executed.  We are implementing error handling at a later stage
in the application.  It would have been better if the code written after the
above call actually checked if something exists in results_list.  But that
is not the case and it would be a pain to change all the code to suit this
need now.

How can I do this?

View raw message