Page 1 of 1

What is the best method to handle errors?

Posted: Thu Jan 08, 2004 7:07 am
by fastfingertips
I have designed an error function that is managing my errors but I would like to know if is there any other method, a better one.

Code: Select all

<?php

function myErrorHandler ($errno, $errstr, $errfile, $errline)
{
//My-SQL errors
$Error_Codes[1]="This is an error";
?>
<HTML>
  <HEAD>
  </HEAD>
  <BODY>
    <table>
      <tr>
        <td>
          <font class="title"><b><? echo $Error_Codes[$errstr];?><br>
        </td>
      </tr>
    </table>
  </BODY>
</HTML>
<?
exit();
}
error_reporting  (E_ERROR);
$old_error_handler = set_error_handler("myErrorHandler");


?>

Posted: Thu Jan 08, 2004 8:18 am
by Nay
I'm not sure but from what I've heard the more common approach is to redirect the user to a "Sorry, there seems to been an error bla bla bla contact webmaster bla bla bla" and log the error that happened. On log, e-mail the webmaster.

-Nay