Jump to content

[SOLVED] Customize error message?


djfox

Recommended Posts

It depends on how you want to "customize it"

 

In a production enviroment it is not good to display real errors to users.

 

In a case like that I would create my own function called "errorReport" or something similiar. This would email the admin the error and then display a friendly message like this:

 

function errorReport($msg, $mysql=false) {
    if ($mysql) {
        $msg .= " MySQL Error: " . mysql_error();
    }

    mail(ADMIN_EMAIL, "Error", $msg, HEADERS); // note ADMIN_EMAIL and HEADERS are constants that need to be defined.

    die("An error has occurred, the admin has been emailed. We apologize for this issue.");
}

 

That way you know about the error and the user is displayed a nice message letting them know about the error.

 

That is how I handle it (well in a similiar fashion just more robust).

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.