From: "Jeremy Quinn" <[EMAIL PROTECTED]> > At 11:08 am +0100 19/3/02, Nicola Ken Barozzi wrote: > >From: "Jeremy Quinn" <[EMAIL PROTECTED]> > > > > > >> Dear All, > >> > >> I am totally mystified as to how you are supposed to handle errors in > >> webapps built using Cocoon. > >> > >> When ever a component in my app throws an exception, I get my (partial) > >> processed XML (as expected) but it is followed by the error definition. > >> > >> That is, I get _two_document_roots_ !!!! > >> > >> How are we supposed to do anything with this? ;) > >> > > > >Dear Jeremy, > > this is a known issue, and basically a worksforme. > > > >Since we use SAX, and the processing is incremental, to augment the users > >percieved performance and decrease memory usage we send the results as soon > >as they are ready. > > > >This means that the error happens when partial results are already > >committed, and error info can only follow already committed output. > > > >If you want you can change the error stylesheet to have inside a javascript > >that redirects the user to a clean error page, or simply output a <p> tag > >that says that an error occurred. > > Ah, can I redirect on error internally and still have the original Request > available?
Redirects are not allowed IIRC, or shouldn't be. They can cause loops, because where you redirect can have errors too. > Basically I am trying to send sensible response when StreamGenerator throws > exceptions on mal-formed XML. Well, there shouldn't be malformed XML being processed. > >If you have a better solution, please commit it, we are all waiting. > > Yea, sorry if I was rude ! > I accept what you say ..... I think that the current error-handling is ok > for publishing, but not good enough for webapps ...... Well, AFAIK, it's not enough yet, but getting better. I haven't had much help on it, and little feedback. I'm happy we can discuss about how to make it become better :-) > Has anyone got examples they can send me of how they have implemented > error-handling in the sitemap, the samples are not very revealing ..... To be honest, there's nothing much to it. In handle-errors you have a sitemap ther has a fixed Generator. You can use Actions, Transformers and a Serializer, like in other sitemaps. IMHO StreamGenerator may not be right for the job. If there is an error in the xml it happens what you saw. But it never happens with normal requests, and it's with those in mind that the error handling, as it is now, was created. Please tell me what you want to do as a bigger picture so I can help you with a possible solution. Thanks :-) -- Nicola Ken Barozzi [EMAIL PROTECTED] - verba volant, scripta manent - (discussions get forgotten, just code remains) --------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]