Quantcast

util:catch() - get info about the error

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

util:catch() - get info about the error

Florent Georges-3
  Hi,

  I just discovered the function util:catch() in the extension
modules documentation.  But I couldn't find the corresponding
entry in the main documentation.  Is there any way to access more
info about the cautgh exception in the $catch-code-blocks? (the
last parameter to util:catch())

  For instance by using another function, or a variable, to get
the error code, a description, etc.

  Regards,

--
Florent Georges
http://fgeorges.org/




     

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: util:catch() - get info about the error

phil
Hi,
There is at least $util:exception and $util:exception-message, which should give you both the errorcode and the description.
Thanks,
Phil
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: util:catch() - get info about the error

Florent Georges-3
phil wrote:

  Hi,

> There is at least $util:exception and $util:exception-message,
> which should give you both the errorcode and the description.

  Great, thank you!  Would you have any pointer within the eXist documentation?

  Regards,

--
Florent Georges
http://fgeorges.org/




     

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: util:catch() - get info about the error

phil
It doesnt seem to be anywhere in the documentation. I logged a doc bug for this (bug #3164984)

Thx,
Phil
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: util:catch() - get info about the error

Florent Georges-3
phil wrote:

> It doesnt seem to be anywhere in the documentation. I
> logged a doc bug for this (bug #3164984)

  Thanks!

--
Florent Georges
http://fgeorges.org/




     

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: util:catch() - get info about the error

Jim Keeney
In reply to this post by Florent Georges-3
I was struggling with trying to find an example of the usage of util:catch the other day and found a list posting that pointed me to the examples in xqts.xql which is in the xqts directory.  The file contains a number of useful techniques.  Among them is this example of using util:catch:

                            util:catch(
                                "java.lang.Exception",
                                doc(xdb:store("/db/XQTS/temp", substring-before($output/text(), "."), xs:anyURI($outputFilePath), "text/xml")),
                                (: Handle unexpected exceptions :)
                                util:log("ERROR", concat("Exception while loading expected result: ", $util:exception-message))
                            )
My understanding is that the first argument is the class of exceptions that you would like to catch.  * works to catch all exceptions. Second argument is the function that you want to call that may cause an exception, and the last argument is the function you would like to call when the exception occurs.

Hope this helps and hope I posted this correctly as I am new to the process.

Jim K.
--

James M. Keeney
Industrial Medium Software, Inc.
Building tools to make communications better
1616 Anderson Rd.
McLean, VA 22102

Hi, I just discovered the function util:catch() in the extension modules documentation. But I couldn't find the corresponding entry in the main documentation. Is there any way to access more info about the cautgh exception in the $catch-code-blocks? (the last parameter to util:catch()) For instance by using another function, or a variable, to get the error code, a description, etc. Regards,

-- Florent Georges http://fgeorges.org/

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...