Skip to content

Commit

Permalink
Merge pull request #28398 from MegaphoneJon/better-ajax-error-handling
Browse files Browse the repository at this point in the history
ensure exception class supports getErrorData
  • Loading branch information
eileenmcnaughton authored Dec 4, 2023
2 parents a2353ce + 5a04c02 commit bc85514
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CRM/Api4/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private function execute(string $entity, string $action, array $params = [], $in
$status = $statusMap[get_class($e)] ?? 500;
// Send error code (but don't overwrite success code if there are multiple calls and one was successful)
$this->httpResponseCode = $this->httpResponseCode ?: $status;
if (CRM_Core_Permission::check('view debug output') || ($e->getErrorData()['show_detailed_error'] ?? FALSE)) {
if (CRM_Core_Permission::check('view debug output') || (method_exists($e, 'getErrorData') && ($e->getErrorData()['show_detailed_error'] ?? FALSE))) {
$response['error_code'] = $e->getCode();
$response['error_message'] = $e->getMessage();
if (!empty($params['debug']) && CRM_Core_Permission::check('view debug output')) {
Expand Down

0 comments on commit bc85514

Please sign in to comment.