PHP Error handling
<p>Thank you one and all ahead of time.</p>

<p>I am currently in the process of tweaking/improving a MVC framework I wrote from scratch for my company. It is relatively new, so it is certainly incomplete. I need to incorporate error handling into the framework (everything should have access to error handling) and it should be able to handle different types and levels of errors (User errors and Framework errors). My question is what is the best way and best mechanism to do this? I know of PHP 5 exception handling and PEAR's different error mechanism, but I have never used any of them. I need something efficient and easy to use. </p>

<p>Would it be better to create my own error handling or use something already made? Any suggestions, tips, questions are certainly welcomed. I would ultimately think it sweetness to somehow register the error handler with PHP so that I would just need to throw the error and then decide what to do with it and whether to continue.</p>

<p>EDIT: Sorry, I should of provided a more details about what type of errors I wanted to log. I am looking to log 2 main types of errors: User and Framework. </p>

<p>For user errors, I mean things like bad urls (404), illegal access to restricted pages, etc. I know I could just reroute to the home page or just blurt out a JavaScript dialog box, but I want to be able to elegently handle these errors and add more user errors as they become evident. </p>

<p>By Framework errors I means things like cannot connect to the database, someone deleted a database table on accident or deleted a file somehow, etc.</p>

<p>Also, I will take care of development and live server handling.</p>
