cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira ...@odoko.co.uk>
Subject LocatedExceptions
Date Mon, 17 Oct 2005 09:59:10 GMT
I've been integrating an external library into Cocoon - a library that
can throw nested exceptions, each of which has a location. So, I want to
build Cocoon style stack traces, starting with the location of each of
the errors within this library, then showing the flowscript where the
error occurred, then the sitemap components, then the sitemaps, etc.

I implemented this by throwing a LocatedException, and adding a number
of locations to that LocatedException. Then, given that the context I am
using this in (Source.toSax()) only allows me to throw SAXExceptions, I
wrap my LocatedException in a SAXException.

I thought I'd got this working, however, when I looked more closely, I
see that the stacktrace from the library stacktrace is just being
included within my LocatedException's message, it wasn't being shown in
the nice stack trace listing (the bit with alternating colours for each
row).

So, somehow, my set of nested exceptions aren't being considered as
Locatable and being added to the stacktrace. How do I make that happen?

I've tried adding each location by doing:

ex = new LocatedException(ex.getMessage(), ex, thisLocation);

and by doing ex.addLocation(thisLocation)

Neither of them seem to create the pretty stack trace, just instead
adding my location details to the exception's message. How do I go about
creating the necessary chain of locations so that they will all print
prettily, and not be included as a part of the exception message? How
can I do that whilst wrapping my exceptions in others, e.g. SAXException?

Regards, Upayavira


Mime
View raw message