Re: some thoughts on error handling (anyone replied?)

From: Date: Wed, 28 Mar 2001 13:33:06 +0000
Subject: Re: some thoughts on error handling (anyone replied?)
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-476@lists.php.net to get a copy of this message
Well, unfortunately, I don't have the previous message with the full e-mail body... but I can tell you that I took the approach explained on php.net (unfortunately, I can't get to the site at the moment; so no URL to reference) and wrote a custom error handler that basically takes my base template and plugs in the error details, and mail me with the details, as well, so that I know if someone is hitting an error. Here's the code, if interested: // We will do our own error handling. error_reporting(0); /*! This function handles all aspects of errors in the system. */ function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars) { $template = new Smarty(); $sErrorMessage = "Error encountered!<br>" . "<br>" . "Err no: " . $errno . "<br>" . "Err Msg:<br> " . $errmsg . "<br><br>" . "Filename: " . $filename . "<br>" . "Line num: " . $linenum . "<br>" . "Vars: " . $vars . "<br>"; mail($admin_email_addr, "MFFL: Error caught.", $sErrorMessage, "From: sitemonitor@mavsfanforlife.com"); $template->assign("error_desc", $sErrorMessage); $template->assign("action_desc", "access the site"); $template->display("index.tpl"); die(); } // Reset the error handle to use this error handler. $old_error_handler = set_error_handler("userErrorHandler"); I have a base error template that basically says, "There was an error while attempting to {$action_desc}. The details of the error are: {$error_desc}". Nothing fancy, but it sure works. Full functional, and it presents the errors in a much better light then the base PHP errors spitting out on the page. -Jason ----- Original Message ----- From: "Marc Logemann" <logemann@morelogs.de> To: <smarty@lists.ispi.net> Sent: Wednesday, March 28, 2001 7:10 AM Subject: [smarty] some thoughts on error handling (anyone replied?) > hi, > > i wrote an email of the subject above, and i would be > excited to know how the developers of smarty think about > that thread. > > So are there any thoughts on that? > > > > ----------------------- > Marc Logemann > Morelogs GmbH & Co. KG > Chief Software Architect > ----------------------- > > Besuchen Sie uns auf der Cebit 2001 > Halle 6 Stand C32 > > --- > You are currently subscribed to smarty as: j-l-alexander@home.com > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ >

« previous php.smarty.general (#476) next »