Jump to content

Recommended Posts

Is there a way that I can create some sort of custom PHP error handling script that is capable of looking at an error that occured and deciding what to do next or what to display to the user (rather than just printing out an error statement)?

 

I'd ideally like this error handler to be in it's own script file so that I can include it in all scripts where an error might possibly occur. 

 

Second, is there a way that you can implement error handling like in other languages such as Visual Basic or C++/C#?

 

For now, I've just been doing something like this:

-------

mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());

--------

 

I'd like to find a way so that if the die() function has to be called because of an error, I can call something else (a function in another script file) and send it some sort of error code that the function would then resolve to a more informative error message the user can understand).

 

Suggestions?

Link to comment
https://forums.phpfreaks.com/topic/240755-customized-php-error-handler-script/
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.