Skip to content

Commit

Permalink
ensure this exception class supports getErrorData
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaphoneJon committed Dec 4, 2023
1 parent 88c59ee commit 5a04c02
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 5a04c02

Please sign in to comment.