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

QueryException improvements #3007

Merged
merged 3 commits into from
Dec 22, 2013
Merged

QueryException improvements #3007

merged 3 commits into from
Dec 22, 2013

Conversation

anlutro
Copy link
Contributor

@anlutro anlutro commented Dec 20, 2013

QueryException expects the previous exception to be a PDOException - if it's not, the exception itself causes a fatal error because $previous->errorInfo is not defined. By adding an if check to the QueryException's constructor it should work with normal Exceptions as well. Alternatively, if a connection statement being ran causes an exception that's not a PDOException it could just be passed on through the app - i.e. only catch PDOExceptions, not all exceptions.

Common causes that would be helped by this would be if you have incorrect statement bindings - for example, trying to pass a multidimensional array as query bindings. However, in this case, formatMessage will fail becase str_replace_array won't accept multidimensional arrays either, but at least the exception will have a decent stack trace. Replacing multidimensional arrays with the word 'Array' could be a possible fix for this when debugging - thoughts?

taylorotwell added a commit that referenced this pull request Dec 22, 2013
@taylorotwell taylorotwell merged commit cfb9c6d into laravel:4.1 Dec 22, 2013
@anlutro anlutro deleted the queryexception branch February 8, 2014 08:01
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

Successfully merging this pull request may close these issues.

2 participants