Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Exceptions not being thrown/caught #32

Open
twigz20 opened this issue Oct 18, 2017 · 2 comments
Open

SQL Exceptions not being thrown/caught #32

twigz20 opened this issue Oct 18, 2017 · 2 comments

Comments

@twigz20
Copy link

twigz20 commented Oct 18, 2017

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?

@mhco
Copy link

mhco commented Mar 29, 2018

@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"?

@Luanr
Copy link

Luanr commented Jul 8, 2022

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

$options = array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ, PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING);

from PDO::ERRMODE_WARNING to PDO::ERRMODE_EXCEPTION

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants