error() breaks when exception code isn't an int
jk3us opened this issue · 2 comments
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?
@jk3us Did you have any luck resolving this? I'm experiencing the same issue.
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.