Can somebody explain the difference between exceptions and errors (specific to PHP)?
Posted
by letseatfood
on Stack Overflow
See other posts from Stack Overflow
or by letseatfood
Published on 2010-05-27T17:50:26Z
Indexed on
2010/05/27
18:01 UTC
Read the original article
Hit count: 165
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!
© Stack Overflow or respective owner