Skip to content

Commit

Permalink
Throw exception rather than fatal
Browse files Browse the repository at this point in the history
This makes it easier to debug if the entityName is not
resolved - in general this is a dev site issue as it is
to do with load order
  • Loading branch information
eileenmcnaughton committed Jul 1, 2021
1 parent f124dfa commit 8567ce4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Civi/Api4/Service/Spec/SpecGatherer.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,13 @@ private function getCustomGroupFields($customGroup, RequestSpec $specification)
* @param string $entityName
*
* @return array
* @throws \API_Exception
*/
private function getDAOFields($entityName) {
private function getDAOFields(string $entityName): array {
$bao = CoreUtil::getBAOFromApiName($entityName);

if (!$bao) {
throw new \API_Exception('Entity not loaded' . $entityName);
}
return $bao::getSupportedFields();
}

Expand Down

0 comments on commit 8567ce4

Please sign in to comment.