[#20] fixed exception handling

This commit is contained in:
B. Endres 2020-05-24 18:57:19 +02:00
parent 3463da4514
commit 9b5165f5a6
3 changed files with 6 additions and 4 deletions

View file

@ -150,7 +150,7 @@ function civicrm_api3_twingle_donation_Cancel($params) {
$result = civicrm_api3_create_success($contribution); $result = civicrm_api3_create_success($contribution);
} }
catch (CiviCRM_API3_Exception $exception) { catch (Exception $exception) {
$result = civicrm_api3_create_error($exception->getMessage()); $result = civicrm_api3_create_error($exception->getMessage());
} }

View file

@ -139,7 +139,7 @@ function civicrm_api3_twingle_donation_endrecurring($params) {
$result = civicrm_api3_create_success($contribution); $result = civicrm_api3_create_success($contribution);
} }
catch (CiviCRM_API3_Exception $exception) { catch (Exception $exception) {
$result = civicrm_api3_create_error($exception->getMessage()); $result = civicrm_api3_create_error($exception->getMessage());
} }

View file

@ -701,14 +701,16 @@ function civicrm_api3_twingle_donation_Submit($params) {
} catch (Exception $ex) { } catch (Exception $ex) {
// TODO: more error handling? // TODO: more error handling?
Civi::log()->debug("Twingle membership postprocessing call {$pp_entity}.{$pp_action} has failed: " . $ex->getMessage()); Civi::log()->debug("Twingle membership postprocessing call {$pp_entity}.{$pp_action} has failed: " . $ex->getMessage());
throw new Exception(
E::ts("Twingle membership postprocessing call has failed, see log for more information")
);
} }
} }
} }
$result = civicrm_api3_create_success($result_values); $result = civicrm_api3_create_success($result_values);
} }
catch (CiviCRM_API3_Exception $exception) { catch (Exception $exception) {
$result = civicrm_api3_create_error($exception->getMessage()); $result = civicrm_api3_create_error($exception->getMessage());
} }