I am currently playing around with classes, interfaces and different programming patterns, and this question yet again came to my mind. How do you handle errors in your applications?
For the moment I am storing all errors in a simple array, $_Errors, then looping through all array elements if an error exists. But this does not feel quite right.
Does any of you have experience with a class to display and react to different types of errors? Should I go with PHPs native error handling functions, like trigger_error() and exceptions, instead of making my own methods?
I used to asked me the same question every time I started a project.
Now the way I use them is if the site/web page can still function (or live) without certain functionality then I make that functionality (like a polling system) to throw Exceptions if there is something wrong with it. But if the site/web page is dependent on that functionality then I throw an error because it's more critical and I need to get to fix it quick.
I don't use my own error/exception handling. I just make sure I let the user now and let myself now (by sending an email, message, twit, ... whatever flows your boat).