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

CRM-11926 Improve error message on APi failure to include DB error message #1

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,12 @@ Developers are highly encouraged to join the CiviCRM forums and post
questions and ideas on the Developer Discussion board:
http://forum.civicrm.org/index.php/board,20.0.html

You can check out the CiviCRM source from
http://svn.civicrm.org/
You can check out the CiviCRM source from https://github.com/civicrm/civicrm-core

Quick install Drupal7 located in {your drupal root}:
$cd /tmp
$wget https://github.com/civicrm/civicrm-core/raw/master/bin/gitify
$gitify Drupal git://github.com/civicrm {your drupal root}/sites/all/modules/civicrm --l10n

longer version:
http://wiki.civicrm.org/confluence/display/CRMDOC42/GitHub+for+CiviCRM
6 changes: 5 additions & 1 deletion api/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ function civicrm_api($entity, $action, $params, $extra = NULL) {
if (CRM_Utils_Array::value('format.is_success', $apiRequest['params']) == 1) {
return 0;
}
$error = $e->getCause();
if ($error instanceof DB_Error) {
$data["error_code"] = DB::errorMessage($error->getCode());
$data["sql"] = $error->getDebugInfo();
}
if (CRM_Utils_Array::value('debug', $apiRequest['params'])) {
$error = $e->getCause();
$data['debug_info'] = $error->getUserInfo();
$data['trace'] = $e->getTraceAsString();
}
Expand Down