mini3 icon indicating copy to clipboard operation
mini3 copied to clipboard

SQL Exceptions not being thrown/caught

Open twigz20 opened this issue 7 years ago • 2 comments

screenshot_11

in the above code, the exception is never thrown and allows the program to proceed smoothly. In the base model, an exception is thrown with a failed DB connection, however, in the extended models, no exception is being thrown with a failed SQL query.

Any idea why?

twigz20 avatar Oct 18 '17 14:10 twigz20

@panique This isn't an issue with the Mini3 framework, but a general PHP question.

That being said, try removing the first catch block, as it really doesn't do anything, and why do you have the slash before "Exception"?

mhco avatar Mar 29 '18 14:03 mhco

If you really want to throw Exceptions using PDO you can change your Error Mode to Exception Mode instead of warnings on Model.php:

https://github.com/panique/mini3/blob/bf66697fe03d8e3e188ce4f44fba3cd80c0c1124/application/Core/Model.php#L35

from PDO::ERRMODE_WARNING to PDO::ERRMODE_EXCEPTION

Luanr avatar Jul 08 '22 15:07 Luanr