title: How to design error reporting in PHP
body: <p>How should I write error reporting modules in PHP?
  Say, I want to write a function in PHP: 'bool isDuplicateEmail($email)'.
  In that function, I want to check if the $email is already present in the database.
  It will return 'true', if exists. Else 'false'.</p>
  
  <p>Now, the query execution can also fail, In that time I want to report 'Internal Error' to the user. </p>
  
  <p>The function should not die with typical mysql error: die(mysql_error(). My web app has two interfaces: browser and email(You can perform certain actions by sending an email).
  In both cases it should report error in good aesthetic.
  Do I really have to use exception handling for this?</p>
  
  <p>Can anyone point me to some good PHP project where I can learn how to design robust PHP web-app?</p>