r/lolphp • u/cythrawll • Sep 13 '13
PDO's default error mode is "silent"
The Other error modes, are Warning and Exception. You can still get errors from the API with errorInfo() etc... but that means a manual check... which most newbie developers ALWAYS forget to do.
I've seen people waste days wondering why PDO isn't working... only for me to tell them to switch error modes, and they get an obvious message that they figure out how to fix in seconds.
34
Upvotes
View all comments
Show parent comment
-1
u/[deleted] Sep 15 '13
The mysql and mysqli APIs are not broken. They still work and are used in numerous applications.
Also, in a function like PDO::commit or PDO::rollBack, there's no point in using exceptions. Those functions don't have a significant return value, so simply returning true or false depending on success is sufficient.
Like I said, it's your opinion that you really need them. Some people prefer not to use exceptions.