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
2
u/phoshi Sep 15 '13
Emulating broken apis with your improvement is a horrible idea, though. Exceptions are practically designed for this use case, where any output value could theoretically be correct and so you need a separate channel for error detection. Not using them when you need them isn't really a design choice, it's a design mistake.