...

View Full Version : looking for an error routine function to send error to my email addy



needsomehelp
03-10-2010, 11:26 PM
I have an AJAX script which is a big buggy at the moment while being created and wish to catch all the errors if any.

does anyone have or know of a basic error routine that can catch these errors and have these stored in another database! or better still sent to my email address so i know there are problems needing sorted out.

as with AJAX client side scripting i am unable to catch every error that the AJAX is getting while sending the requests to the server.

or is there another way to catch these errors on the server directly, do they get stored somewhere?

tomws
03-11-2010, 12:19 AM
What this has to do with MySQL, I can't figure out. However, as to your question:

or is there another way to catch these errors on the server directly

Yes: programming. That's your job as the coder.

Fou-Lu
03-11-2010, 03:49 PM
This depends on what the error is. If its a JS error, you'll need to capture that using JS and send it back to PHP. If its a PHP error, you can trap it by specifying a set_error_handler (http://php.net/manual/en/function.set-error-handler.php).

Note that this is one of the very few times where if you need to access a global variable you must actually globalize it since the signature for the error handler callback is in stone. You're callback may include writing to a database or emailing errors. I would write it to a DB myself, no point in emailing this off directly. You can also contain this within a global variable, and register a shutdown function to either write it all to a database or to email it to you're account.

needsomehelp
03-11-2010, 05:42 PM
it would be the JS I would need to capture and I already know and use the PHP method for the other server side routines. it is the JS client side routines that i need to know about, should there be any errors.

can you advise what i need to do to get these errors if any.?

Fou-Lu
03-11-2010, 05:44 PM
it would be the JS I would need to capture and I already know and use the PHP method for the other server side routines. it is the JS client side routines that i need to know about, should there be any errors.

can you advise what i need to do to get these errors if any.?

Write a new script to handle the JS errors with PHP, and use AJAX to capture the errors and send them to this script. Thats really the only way to deal with the client sided errors since they are not capable of emailing or updating databases on their own (at least not you're server database.... easily).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum