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

APIv3 - Use the Exception rather than the rule #24977

Merged
merged 1 commit into from
Nov 15, 2022

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Nov 15, 2022

Overview

Following up on #19323 this converts APIv3 in Smarty and Ajax to use exceptions instead of CRM_Core_TemporaryErrorScope which is self-described as "An evil, evil work-around", so I'm gonna say we're better off not using it.

Before

The "evil, evil work-around" was causing problems like this:

  1. Disable the SearchKit extension
  2. In your browser console run CRM.api3('Extension', 'install', {key: 'org.civicrm.search_kit'});
  3. Fails with a bunch of uncaught errors.

After

SearchKit can be installed via ajax without errors, and there's generally less evil in the world.

Technical Details

Now that PEAR throws exceptions there is no need to override the PEAR error handler and it was interfering with try/catch handlers within the api call.

Following up on civicrm#19323 this converts APIv3 in Smarty and Ajax to use exceptions instead
of overriding the PEAR exception handler. Now that PEAR throws exceptions there is
no need to do so and it was interfering with try/catch handlers within the api call.
@civibot
Copy link

civibot bot commented Nov 15, 2022

(Standard links)

@civibot civibot bot added the master label Nov 15, 2022
@mattwire mattwire merged commit 6bd015c into civicrm:master Nov 15, 2022
@colemanw colemanw deleted the exceptions branch November 15, 2022 19:38
@colemanw
Copy link
Member Author

Thanks @mattwire

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