views:

19

answers:

1

I'm thinking about some optimal methods for gracefully handling errors on a website. I'm thinking that two modes will dictate how errors are handled:

Development Mode

  • Shows all notices, warning, and fatal errors on the view they are generated from
  • Errors are displayed in raw format

Production Mode

  • Hide all notices and warnings, no matter what
  • Redirect fatal errors to a page (something like the fail whale)
    • Tell the user that the error has been logged
    • Store information about the error in the database or some other type of log (developer's choice)
    • E-mail the error to an array of e-mail addresses (developer's choice)

What are your thoughts on this approach? Can you think of a better way to handle errors?

+1  A: 

Production mode - instead of emailing developers and storing the error to databases yourself. Integrate with defect/bug tracking system like Bugzilla, let it handle all the emailing, assignments, etc... No need to reinvent the wheel. Integration is simple, just use Bugzilla web services.

Alex