Can somebody explain the difference between exceptions and errors (specific to PHP)?
- by letseatfood
I am having trouble figuring the best way to display errors to my clients.
Should I use exceptions or errors?
For example, if the user's login information does not match the database, should I throw new Exception('Login information is incorrect. Please try again.') and catch it with an exception handler using set_exception_handler()?
Or, should I use trigger_error() to display an error message to the user?
I think the main issue is that I cannot differentiate between errors and exceptions. I have read a lot of "answers" to this question on the internet and in some books, but it seems that people are really divided or aren't sure.
Thanks!