Skip to content

Commit

Permalink
Mass-replace CiviCRM_API3_Exception and API_Exception with CRM_Core_E…
Browse files Browse the repository at this point in the history
…xception
  • Loading branch information
colemanw committed Sep 15, 2022
1 parent 6feb8b0 commit e071b50
Show file tree
Hide file tree
Showing 840 changed files with 1,565 additions and 2,472 deletions.
2 changes: 1 addition & 1 deletion CRM/ACL/Form/EntityRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function buildQuickForm() {
/**
* Process the form submission.
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
*/
public function postProcess(): void {
CRM_ACL_BAO_Cache::resetCache();
Expand Down
7 changes: 3 additions & 4 deletions CRM/Activity/BAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public static function logActivityAction($activity, $logMessage = NULL) {
*
* @return array
* Relevant data object values of open activities
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public static function getActivities($params) {
$activities = [];
Expand Down Expand Up @@ -1001,7 +1001,6 @@ public static function createEmailActivity($sourceContactID, $subject, $html, $t
*
* @deprecated
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
*/
public static function sendEmail(
Expand Down Expand Up @@ -1906,7 +1905,7 @@ public static function restoreActivity(&$params) {
* @param int $type
*
* @return array
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public static function getStatusesByType($type) {
if (!isset(Civi::$statics[__CLASS__][__FUNCTION__])) {
Expand All @@ -1932,7 +1931,7 @@ public static function getStatusesByType($type) {
* @param array $activity
*
* @return bool
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public static function isOverdue($activity) {
return array_key_exists($activity['status_id'], self::getStatusesByType(self::INCOMPLETE)) && CRM_Utils_Date::overdue($activity['activity_date_time']);
Expand Down
3 changes: 1 addition & 2 deletions CRM/Activity/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public static function from($name, $mode, $side) {
/**
* Get the metadata for fields to be included on the activity search form.
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @todo ideally this would be a trait included on the activity search & advanced search
* rather than a static function.
*/
Expand All @@ -431,7 +431,6 @@ public static function getSearchFieldMetadata() {
*
* @param CRM_Core_Form_Search $form
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public static function buildSearchForm(&$form) {
Expand Down
3 changes: 1 addition & 2 deletions CRM/Activity/Form/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ public function setDefaultValues() {
* Build Quick form.
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function buildQuickForm() {
if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
Expand Down Expand Up @@ -886,7 +885,7 @@ public static function formRule($fields, $files, $self) {
* @param array $params
*
* @return array|null
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public function postProcess($params = NULL) {
if ($this->_action & CRM_Core_Action::DELETE) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Activity/Form/ActivityLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function commonBuildQuickForm($self) {
],
]);
}
catch (CiviCRM_API3_Exception $e) {
catch (CRM_Core_Exception $e) {
continue;
}
if (!$phone['api.Contact.getsingle']['do_not_sms'] && $phone['phone']) {
Expand Down
6 changes: 2 additions & 4 deletions CRM/Activity/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function getDefaultEntity(): string {
* Processing needed for buildForm and later.
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function preProcess(): void {
$this->set('searchFormName', 'Search');
Expand Down Expand Up @@ -121,7 +120,6 @@ public function preProcess(): void {
* Build the form object.
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function buildQuickForm(): void {
parent::buildQuickForm();
Expand Down Expand Up @@ -153,7 +151,7 @@ public function buildQuickForm(): void {
* The processing consists of using a Selector / Controller framework for getting the
* search results.
*
* @throws \CRM_Core_Exception|\CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public function postProcess(): void {
if ($this->_done) {
Expand Down Expand Up @@ -316,7 +314,7 @@ public function getTitle() {
*
* @return array
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
protected function getEntityMetadata() {
return CRM_Activity_BAO_Query::getSearchFieldMetadata();
Expand Down
2 changes: 1 addition & 1 deletion CRM/Activity/Import/Parser/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function import($values) {
* @param array $values
*
* @return array
* @throws \API_Exception
* @throws \CRM_Core_Exception
*/
public function getMappedRow(array $values): array {
$params = [];
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function postProcess() {
try {
$this->saveMetadataDefinedSettings($params);
}
catch (CiviCRM_API3_Exception $e) {
catch (CRM_Core_Exception $e) {
CRM_Core_Session::setStatus($e->getMessage(), ts('Save Failed'), 'error');
}
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function buildQuickForm($check = FALSE) {
* @param array $fields
*
* @return array|bool
* @throws API_Exception
* @throws CRM_Core_Exception
*/
public static function formRule($fields) {

Expand Down
2 changes: 0 additions & 2 deletions CRM/Admin/Form/MessageTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Core_Form {
/**
* PreProcess form - load existing values.
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
Expand Down Expand Up @@ -268,7 +267,6 @@ public static function formRule($params, $files, $self) {
/**
* Process the form submission.
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
Expand Down
3 changes: 1 addition & 2 deletions CRM/Admin/Form/PaymentProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ public function setDefaultValues() {
/**
* Process the form submission.
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public function postProcess() {
Expand Down Expand Up @@ -451,7 +450,7 @@ public function postProcess() {
* @param int $domainID
* @param bool $test
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public function updatePaymentProcessor(&$values, $domainID, $test) {
if ($test) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function postProcessCommon() {
$this->saveMetadataDefinedSettings($this->_params);
$this->filterParamsSetByMetadata($this->_params);
}
catch (CiviCRM_API3_Exception $e) {
catch (CRM_Core_Exception $e) {
CRM_Core_Session::setStatus($e->getMessage(), ts('Save Failed'), 'error');
}

Expand Down
1 change: 0 additions & 1 deletion CRM/Admin/Form/Preferences/Contribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
/**
* Build the form object.
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
public function buildQuickForm() {
Expand Down
4 changes: 1 addition & 3 deletions CRM/Admin/Form/ScheduleReminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public function setComponentID($compId): void {
* Build the form object.
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function buildQuickForm(): void {
parent::buildQuickForm();
Expand Down Expand Up @@ -302,7 +301,6 @@ public function buildQuickForm(): void {
* @return array|bool
* True if no errors, else array of errors
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
public static function formRule(array $fields, $files, $self) {
Expand Down Expand Up @@ -483,7 +481,7 @@ public function postProcess() {
* The submitted form values.
*
* @return CRM_Core_DAO_ActionSchedule
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
public function parseActionSchedule($values) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function commonProcess(&$params) {
try {
$this->saveMetadataDefinedSettings($params);
}
catch (CiviCRM_API3_Exception $e) {
catch (CRM_Core_Exception $e) {
CRM_Core_Session::setStatus($e->getMessage(), ts('Save Failed'), 'error');
}

Expand Down
6 changes: 2 additions & 4 deletions CRM/Admin/Form/SettingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ protected function getSettingsOrderedByWeight() {
* Add fields in the metadata to the template.
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
protected function addFieldsDefinedInSettingsMetadata() {
$this->addSettingsToFormFromMetadata();
Expand Down Expand Up @@ -323,7 +322,6 @@ protected function getQuickFormType($spec) {
*
* All others are pending conversion.
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
protected function setDefaultsForMetadataDefinedFields() {
Expand Down Expand Up @@ -351,7 +349,7 @@ protected function setDefaultsForMetadataDefinedFields() {
* @param array $params
* Form input.
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
protected function saveMetadataDefinedSettings($params) {
$settings = $this->getSettingsToSetByMetadata($params);
Expand Down Expand Up @@ -402,7 +400,7 @@ private function getReorderedSettingData($setting, $settingValue) {
/**
* Add settings to form if the metadata designates they should be on the page.
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
protected function addSettingsToFormFromMetadata() {
$filter = $this->getSettingPageFilter();
Expand Down
4 changes: 2 additions & 2 deletions CRM/Admin/Page/PaymentProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function run() {
*
* @param null $action
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
*/
public function browse($action = NULL): void {
$paymentProcessors = PaymentProcessor::get(FALSE)
Expand Down Expand Up @@ -138,7 +138,7 @@ public function browse($action = NULL): void {
try {
$paymentProcessors[$paymentProcessorID]['test_id'] = CRM_Financial_BAO_PaymentProcessor::getTestProcessorId($paymentProcessorID);
}
catch (CiviCRM_API3_Exception $e) {
catch (CRM_Core_Exception $e) {
CRM_Core_Session::setStatus(ts('No test processor entry exists for %1. Not having a test entry for each processor could cause problems', [$paymentProcessor['name']]));
}
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Batch/Form/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function setDefaultValues() {
/**
* Process the form submission.
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
*/
public function postProcess(): void {
if ($this->_action & CRM_Core_Action::DELETE) {
Expand Down
10 changes: 1 addition & 9 deletions CRM/Batch/Form/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ public function setDefaultValues() {
* Process the form after the input has been submitted and validated.
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function postProcess() {
$params = $this->controller->exportValues($this->_name);
Expand Down Expand Up @@ -561,7 +560,6 @@ public function postProcess() {
* @return bool
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
private function processContribution(&$params) {

Expand Down Expand Up @@ -766,8 +764,6 @@ private function processContribution(&$params) {
* batch total monetary amount.
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
* @throws \API_Exception
*/
private function processMembership(array $params) {
$batchTotal = 0;
Expand Down Expand Up @@ -925,7 +921,7 @@ private function processMembership(array $params) {
*
* @return bool
* true if mail was sent successfully
* @throws \CRM_Core_Exception|\API_Exception
* @throws \CRM_Core_Exception
*
*/
protected function emailReceipt($form, &$formValues): bool {
Expand Down Expand Up @@ -1027,7 +1023,6 @@ public function testProcessMembership($params) {
* @return bool
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function testProcessContribution($params) {
return $this->processContribution($params);
Expand All @@ -1040,7 +1035,6 @@ public function testProcessContribution($params) {
* @return CRM_Member_BAO_Membership
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
protected function legacyProcessMembership($customFieldsFormatted, $formDates = []): CRM_Member_DAO_Membership {
$updateStatusId = FALSE;
Expand Down Expand Up @@ -1179,7 +1173,6 @@ private function standardiseRow(array $row): array {
* @return bool
*
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
private function currentRowIsRenew(): bool {
return $this->currentRowIsRenewOption === 2 && $this->getCurrentMembership();
Expand All @@ -1190,7 +1183,6 @@ private function currentRowIsRenew(): bool {
*
* @return array|bool
*
* @throws \CiviCRM_API3_Exception
* @throws \CRM_Core_Exception
*/
protected function getCurrentMembership() {
Expand Down
Loading

0 comments on commit e071b50

Please sign in to comment.