[PHP] Trapping PHP Errors
Hi everyone, How do I trap a PHP error and display my own error message instead? I have two PHP scripts - one that creates tables on MSSQL and one that deletes tables on MSSQL. I wish to capture the message that appears if the user attempts to create tables that already exist, or delete ones that do not exist. Thanks in advance Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trapping PHP Errors
How do I trap a PHP error and display my own error message instead? I have two PHP scripts - one that creates tables on MSSQL and one that deletes tables on MSSQL. I wish to capture the message that appears if the user attempts to create tables that already exist, or delete ones that do not exist. http://us2.php.net/manual/en/function.set-error-handler.php ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trapping PHP errors
Michael Sims wrote: My site has a custom error handler (implemented via set_error_handler) which sends a nicely formatted email including all of the error details, a variable dump, the contents of the output buffer before the error occured, and the contents of a call to debug_backtrace, in addition to logging the error to a file. If it's not asking too much would you be willing to share that custome error handler you wrote? I'm in the process of writing one but wouldn't want to re-invent the wheel if I didn't have too :) Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trapping PHP errors
On Wed, 15 Jan 2003 13:25:05 +0900, you wrote: If it's not asking too much would you be willing to share that custome error handler you wrote? It's a big long so I'm sending it to you off-list. If anyone else is interested just send me an email off list and I'll send you a copy... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trapping PHP errors
Hi all, is there a way to execute a custom function as soon as an error happens in PHP? I looked at the set_error_handler function, but it doesn't seem to trap all the errors. What I want to achieve is to execute a function that mails me the error everytime an error happens. Cheers, Pieter
Re: [PHP] Trapping PHP errors
On Tue, 14 Jan 2003 23:38:11 +0100, you wrote: Hi all, is there a way to execute a custom function as soon as an error happens in PHP? I looked at the set_error_handler function, but it doesn't seem to trap all the errors. What I want to achieve is to execute a function that mails me the error everytime an error happens. My site has a custom error handler (implemented via set_error_handler) which sends a nicely formatted email including all of the error details, a variable dump, the contents of the output buffer before the error occured, and the contents of a call to debug_backtrace, in addition to logging the error to a file. We've used it in some form or another for nearly a year now and it's been very helpful. set_error_handler effectively traps every error you're likely to encounter with the exception of parse errors. And if you have a script with a parse error, you'll know it pretty quickly and likely won't need to be emailed, which means that for all intents and purposes, set_error_handler traps all errors. Is there a specific problem you're having with set_error_handler, or a specific error that you were hoping your custom function would catch that is isn't? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php