Re: some thoughts on error handling (anyone replied?)
| From: | Andrei Zmievski | Date: | Wed, 28 Mar 2001 17:04:57 +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-483@lists.php.net to get a copy of this message | ||
On Wed, 28 Mar 2001, Jason Alexander wrote:
> /*!
> 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}".
I'm curious, why is "access the site" hardcoded in the error handler?
What if you want your action description to be different?
-Andrei
* Why is it always Segmentation's fault? *