Re: Handling Errors Gracefully

From: Date: Sat, 09 Nov 2002 23:02:54 +0000
Subject: Re: Handling Errors Gracefully
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-123634@lists.php.net to get a copy of this message
imho there are many problems with a handler of this type... since an error could occur anywhere--in the middle of an HTML tag, or within a block of client-side script code--you don't know for sure that the Javascript is going to be interpreted properly by the browser...and therefore it may look messy and/or not work at all. Marco -- ------------ php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmers Check us out on the web at http://www.phparch.com On Sat, 2002-11-09 at 18:05, Ernest E Vogelsinger wrote: > Ok, it's late, and my last post for today, but I need to get this right ;-) > > <?php > if ($we_found_an_error) { > $url = 'http://' . $_SERVER['SERVER_NAME'] . > '/my_error_handler.php?any_parameters_you_need'; > echo '<script language="JavaScript">', > 'document.location.href="', $url, '">', > '</script>', > '<hr>', > 'A nasty error has occurred. If you are not redirected ', > 'to the correct page, <a href="',$url,'">click here</a> to', > 'continue (sorry folks)', > '</script></body></html>'; > exit; > } > // else no error - continue > > ?> > > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#123634) next »