-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Add more error output for db error in drush #666
base: 7.x-master
Are you sure you want to change the base?
Conversation
(Standard links)
|
catch (API_Exception $e) { | ||
catch (DBQueryException $e) { | ||
drush_set_error('CIVICRM api error', $e->getDBErrorMessage() . ' ' . $e->getUserMessage() | ||
. (in_array('debug=1', $args, TRUE) ? "\n" . $e->getSQL() : '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
. (in_array('debug=1', $args, TRUE) ? "\n" . $e->getSQL() : '') | |
. (!empty($params['debug']) ? ("\n" . $e->getSQL()) : '') |
$args has already been parsed and put into params, and depending on how you specify the args it might not look like debug=1
. In fact I couldn't even figure out how to use this for api4 without using the json method where it's not in args.
Also for me getSQL() returned blank, but that's not a blocker maybe it depends what the error situation is. For me I forced a db syntax error.
I also get a secondary error Undefined variable $result
, but it's not because of the PR. A followup could wrap the output block below to only run if $result
actually got set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@demeritcowboy then I think maybe checking debug is too complex & just add the extra output?
I just trialled this patch as getting the data better - of course now I found why I had an error I need to switch to solving it
|
Without this it just says there was an error - no clue as to what