Redirecting to an error page etc., if an exception is caught using WAListenerAdapter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Redirecting to an error page etc., if an exception is caught using WAListenerAdapter

John Toohey
Hi,
I'm trapping all my apps exceptions in a custom exception handler, and
would like to 1) redirect to an error page, or 2) emit custom HTML
into the stream. However when an exception is raised and my handler is
called, the WAStreamResponse is already committed, so I cannot do
anything with it. Is there an easy solution to this problem? How are
people dealing with this issue in general?

--
~JT
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Redirecting to an error page etc., if an exception is caught using WAListenerAdapter

Philippe Marschall
2011/10/11 John Toohey <[hidden email]>:
> Hi,
> I'm trapping all my apps exceptions in a custom exception handler, and
> would like to 1) redirect to an error page, or 2) emit custom HTML
> into the stream. However when an exception is raised and my handler is
> called, the WAStreamResponse is already committed, so I cannot do
> anything with it. Is there an easy solution to this problem?

There is no solution to this problem. You can't put on no safety belts
but still have them on in case of accidents. If you don't like this
behavior, don't use WAListenerAdapter.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Redirecting to an error page etc., if an exception is caught using WAListenerAdapter

John Toohey
If I don't use that adapter then I cannot use Comet. I thought ST
exceptions were raised before any stack unwind, so why has the stream
been committed before the exception fires? Is the only solution to let
the browser hang, and have the user refresh?

On Tue, Oct 11, 2011 at 03:10, Philippe Marschall
<[hidden email]> wrote:

> 2011/10/11 John Toohey <[hidden email]>:
>> Hi,
>> I'm trapping all my apps exceptions in a custom exception handler, and
>> would like to 1) redirect to an error page, or 2) emit custom HTML
>> into the stream. However when an exception is raised and my handler is
>> called, the WAStreamResponse is already committed, so I cannot do
>> anything with it. Is there an easy solution to this problem?
>
> There is no solution to this problem. You can't put on no safety belts
> but still have them on in case of accidents. If you don't like this
> behavior, don't use WAListenerAdapter.
>
> Cheers
> Philippe
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



--
~JT
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Redirecting to an error page etc., if an exception is caught using WAListenerAdapter

Philippe Marschall
2011/10/11 John Toohey <[hidden email]>:
> If I don't use that adapter then I cannot use Comet. I thought ST
> exceptions were raised before any stack unwind, so why has the stream
> been committed before the exception fires?

It streams. As soon as the body rendering starts the response header
gets committed and from there on the response is getting streamed as
it's being rendered.

> Is the only solution to let
> the browser hang, and have the user refresh?

Your can try to append the following:

"><script>/* some fancy JavaScript */</script>

Which may or may not work.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside