Error Handling

Discussion in 'PHP' started by NoamBarz, Jul 30, 2009.

  1. #1
    I'm working on a big website and was wondering what the best way to handle errors is. Should I create error messages the user can see (at least that way I can be notified)? should I hide them and write them in a log (I find that it's difficult to create helpful log entries - reinacting what came before the error isn't that easy)? should i redirect to the homepage on every error (could be annoying for th users)? what's the textbook approach?
     
    NoamBarz, Jul 30, 2009 IP
  2. SkullKing

    SkullKing Guest

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You dont want to confuse members with difficult to understand errors, just make a quick error.html page and redirected users to that while logging the error at the same time.
     
    SkullKing, Jul 30, 2009 IP
  3. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Be sure to log the URL, the referring URL, the user ID (if logged in), the error type and error message. If necessary, serialize the $_POST array as well. This will help you figure out what happened.
     
    premiumscripts, Aug 3, 2009 IP