Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Posts
    445
    Thanks
    7
    Thanked 3 Times in 3 Posts

    looking for an error routine function to send error to my email addy

    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?

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    What this has to do with MySQL, I can't figure out. However, as to your question:
    Quote Originally Posted by needsomehelp View Post
    or is there another way to catch these errors on the server directly
    Yes: programming. That's your job as the coder.
    Are you a Help Vampire?

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.

    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #4
    Regular Coder
    Join Date
    Oct 2009
    Posts
    445
    Thanks
    7
    Thanked 3 Times in 3 Posts
    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.?

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by needsomehelp View Post
    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).
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •