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

error() breaks when exception code isn't an int #298

Open
jk3us opened this issue Jul 29, 2015 · 2 comments
Open

error() breaks when exception code isn't an int #298

jk3us opened this issue Jul 29, 2015 · 2 comments

Comments

@jk3us
Copy link

jk3us commented Jul 29, 2015

https://github.com/chriso/klein.php/blob/master/src/Klein/Klein.php#L931

throw new UnhandledException($msg, $err->getCode(), $err);

I'm not exactly the mechanism this got called, but it got called when I had a PDO Exception. The problem is that getCode on a PDOException doesn't always return an int. This is mentioned at https://secure.php.net/manual/en/exception.getcode.php. "Returns the exception code as integer in Exception but possibly as other type in Exception descendants (for example as string in PDOException)."

So instead of my global exception handler telling me what went wrong, I got an error about a Wrong parameters passed to the Exception constructor. Maybe just rethrow the same exception instead of wrapping it in an UnhandledException, which might other important info in the original?

@jonahgeorge
Copy link

@jk3us Did you have any luck resolving this? I'm experiencing the same issue.

@jk3us
Copy link
Author

jk3us commented Dec 15, 2015

I don't think I ever did. After figuring out which exception was causing the problem, I fixed the error in my sql query and haven't had to deal with it since. Sorry.

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

2 participants