Mailing List Archive

How to generate nice error pages ?
I'll explain what I'm trying to do. I'm doing database lookups and
generating pages from them. I check all return values from the DBI
functions, and I want to generate user-friendly error report pages if
anything goes wrong.

The trouble is that at the point when I detect the error, I can already be
half-way through a table. At this point, it seems that it's already too
late to generate a nice error page. I can either `die' and let the embperl
handler catch it, but this makes it look like a bug in my code rather than
something user-friendly. The other alternative is dumping the error report
on the bottom of the page, but this is a bit of a mess.

What I want to be able to do is to ask Embperl to abort the page generated
so far, and start afresh with a new one. That way I can do
Execute('error.html', "XXX went wrong"), and generate a user-friendly page.

Is it possible to do this as things stand in Embperl ?

One alternate method that seemed to work was to do a redirect to an error
page, putting the message in as a GET parameter. It is messy because I
can't see how to URL-encode the message easily, but it seems to work:

<meta http-equiv="Location" content="error.html?msg=XXX+went+wrong">

Is this a good idea ?

Is there any other way of doing this that I've missed ?

Thanks for the help -

Jim

--
Jim Peters / __ | \ Aguazul
/ /| /| )| /| / )|| \
jim@aguazul. \ (_|(_|(_|(_| )(_|I / www.aguazul.
demon.co.uk \ ._) _/ / demon.co.uk