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

dev/core#2984 - Clarify API error when component is disabled #22231

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Dec 9, 2021

Overview

Clarifies API failures due to disabled components. Fixes https://lab.civicrm.org/dev/core/-/issues/2984

Before

Using an API from a disabled component would fail in unexpected ways with cryptic error messages.

After

Using an API from a disabled component will throw a NotImplementedException with a message like "Case API is not available because CiviCase component is disabled"

…t is disabled

Previously, using an API from a disabled component would fail in unexpected ways
with cryptic error messages. Now it's clearly not allowed.
@civibot
Copy link

civibot bot commented Dec 9, 2021

(Standard links)

@civibot civibot bot added the master label Dec 9, 2021
@colemanw colemanw changed the title Fixes dev/core#2984 - Clear API error message when entity's component is disabled Fixes dev/core#2984 - Clarify API error when component is disabled Dec 9, 2021
@colemanw colemanw changed the title Fixes dev/core#2984 - Clarify API error when component is disabled dev/core#2984 - Clarify API error when component is disabled Dec 9, 2021
@colemanw
Copy link
Member Author

colemanw commented Dec 9, 2021

Ping @totten

@totten
Copy link
Member

totten commented Dec 9, 2021

Looks good @colemanw. Test coverage makes sense.

I did some r-run using CIviCase component and CaseType API. The error message looks a lot nicer. (Old and new messages below.)

  [Symfony\Component\Debug\Exception\FatalThrowableError]                   
  Type error: array_merge(): Argument #1 must be of type array, null given  
  [Civi\API\Exception\NotImplementedException]                          
  CaseType API is not available because CiviCase component is disabled  

Merging

@totten totten merged commit 3cadaab into civicrm:master Dec 9, 2021
@totten totten deleted the apiDisabledComponent branch December 9, 2021 21:03
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