mini3
mini3 copied to clipboard
SQL Exceptions not being thrown/caught
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?
@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"?
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