You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Leszek Gawron <ou...@kompuart.pl> on 2002/11/19 15:49:54 UTC

ESQL exception problem

I know that including <esql:error-results> in <esql:connection> prevents from
throwing exceptions. The problem is that if the database is unreachable the
RuntimeExceptions is throw by esql and this one is not caught by
errors-results. So if you want to manage all esql errors you should do sth
like:

<xsp:logic>
    try {
        <esql:connection>
            <esql:pool>cdn</esql:pool>
            <esql:execute-query>
                <esql:query>select * from foo</esql:query>
                <esql:results>
                    <esql:row-results>
                        <row>
                            <esql:get-columns/>
                        </row>
                    </esql:row-results>
                </esql:results>
                <esql:no-results>
                    <info>no results<info>
                </esql:no-results>
                <esql:error-results>
                    <error>query error</error>
                </esql:error-results>
            </esql:execute-query>
        </esql:connection>
    } catch ( RuntimeException e ) {
        <error>database error</error>
    }
</xsp:logic>

so you're not able to catch all errors without using additional Java code. Is
there any way to handle it more nicely?
	ouzo
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: ESQL exception problem

Posted by Christian Haul <ha...@informatik.tu-darmstadt.de>.
Leszek Gawron wrote:
> I know that including <esql:error-results> in <esql:connection> prevents from
> throwing exceptions. The problem is that if the database is unreachable the
> RuntimeExceptions is throw by esql and this one is not caught by
> errors-results. So if you want to manage all esql errors you should do sth
> like:

[...]

> so you're not able to catch all errors without using additional Java code. Is
> there any way to handle it more nicely?

Only from the sitemap (i.e. map:handle-errors)

	Chris

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
     fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>