Add more error output for db error in drush#666
Add more error output for db error in drush#666eileenmcnaughton wants to merge 1 commit intocivicrm:7.x-masterfrom
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.
| . (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.
@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