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

Fix Error handling following DB Package upgrade #16213

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

seamuslee001
Copy link
Contributor

Overview

We recently upgraded the DB package such that any DB_Error class error would actually satisfy the is_callable([$ei, 'getCause']) now because there has been __call function declared https://github.com/civicrm/civicrm-packages/blob/master/DB.php#L1010

Before

E-notice error message about undefined function getCause for DB_Error class see https://test.civicrm.org/job/CiviCRM-Core-Edge/CIVIVER=master,label=test-3/4/testReport/(root)/CRM_Export_BAO_ExportTest/testExportDeceasedDoNotMail_with_data_set__1/ as an example

After

No e-notice error message

ping @eileenmcnaughton

@civibot
Copy link

civibot bot commented Jan 5, 2020

(Standard links)

@civibot civibot bot added the master label Jan 5, 2020
@seamuslee001
Copy link
Contributor Author

sample error output after patch

PEAR_Exception: "DB Error: syntax error"
 * ERROR TYPE: DB_Error
 * ERROR CODE: -2
 * ERROR MESSAGE: DB Error: syntax error
 * ERROR MODE: 16
 * ERROR USERINFO: INSERT INTO
   civicrm_option_value (option_group_id, label, value, name, grouping, filter, is_default, weight, description, is_optgroup, is_reserved, is_active, component_id, visibility_id)
VALUES
   (@option_group_id_report, 'Deferred Revenue Details', 'contribute/deferredrevenue', 'CRM_Report_Form_Contribute_DeferredRevenue', NULL, 0, NULL, @option_group_id_report_wt+1, 'Deferred Revenue Details Report', 0, 0, 1, @contributeCompId, NULL) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'grouping, filter, is_default, weight, description, is_optgroup, is_reserved, is_' at line 2]
 * ERROR DEBUGINFO: INSERT INTO
   civicrm_option_value (option_group_id, label, value, name, grouping, filter, is_default, weight, description, is_optgroup, is_reserved, is_active, component_id, visibility_id)
VALUES
   (@option_group_id_report, 'Deferred Revenue Details', 'contribute/deferredrevenue', 'CRM_Report_Form_Contribute_DeferredRevenue', NULL, 0, NULL, @option_group_id_report_wt+1, 'Deferred Revenue Details Report', 0, 0, 1, @contributeCompId, NULL) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'grouping, filter, is_default, weight, description, is_optgroup, is_reserved, is_' at line 2]
#0 /home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
#1 /home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/packages/DB.php(997): PEAR_Error->__construct("DB Error: syntax error", -2, 16, (Array:2), "INSERT INTO\n   civicrm_option_value (option_group_id, label, value, name, gr...")
#2 /home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-2, 16, (Array:2), "INSERT INTO\n   civicrm_option_value (option_group_id, label, value, name, gr...")
#3 /home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -2, 16, (Array:2), "INSERT INTO\n   civicrm_optio
table style="border: 1px" cellspacing="0">                                                                                                                                                                                                                                                                       ESC[31;40m
ESC[1m[error]ESC[0m
<tr><td colspan="3" style="background: #ff9999"> <b>PEAR_Exception</b>: DB Error: syntax error in <b>/home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php</b> on line <b>922</b></td></tr>
<tr><td colspan="3" style="background: #ff9999">- <b>DB_Error</b>: DB Error: syntax error in <b>unknown</b> on line <b>unknown</b></td></tr>
<tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>
<tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td><td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td><td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>
<tr><td style="text-align: center;">0</td><td>CRM_Core_Error::exceptionHandler(Object(DB_Error))</td><td>/home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922</td></tr>
<tr><td style="text-align: center;">1</td><td>PEAR_Error->__construct('DB Error: syntax&hellip;', -2, 16, Array, 'INSERT INTO
   c&hellip;')</td><td>/home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/packages/DB.php:997</td></tr>
<tr><td style="text-align: center;">2</td><td>DB_Error->__construct(-2, 16, Array, 'INSERT INTO
   c&hellip;')</td><td>/home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:575</td></tr>
<tr><td style="text-align: center;">3</td><td>PEAR->_raiseError(Object(DB_mysqli), null, -2, 16, Array, 'INSERT INTO
   c&hellip;', 'DB_Error', true)</td><td>/home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:223</td></tr>
<tr><td style="text-align: center;">4</td><td>PEAR->__call('raiseError', Array)</td><td>/home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/packages/DB/common.php:1925</td></tr>
<tr><td style="text-align: center;">5</td><td>DB_common->raiseError(-2, null, null, 'INSERT INTO
   c&hellip;', '1064 ** You have&hellip;')</td><td>/home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/packages/DB/mysqli.php:935</td></tr>
<tr><td style="text-align: center;">6</td><td>DB_mysqli->mysqliRaiseError()</td><td>/home/seamus/buildkit/build/civi-dev/web/sites/all/modules/civicrm/packages/DB/mysqli.php:405</td></tr>
<tr><td style="text-align: center;">7</td><td>DB_mysqli->simpleQuery('INSERT INTO

@seamuslee001
Copy link
Contributor Author

Jenkins re test this please

@eileenmcnaughton eileenmcnaughton merged commit 1737209 into civicrm:master Jan 6, 2020
@eileenmcnaughton eileenmcnaughton deleted the error_handling_fix branch January 6, 2020 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants