From 8567ce451f82a90d07a4373dc4077b94e1d134fe Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 1 Jul 2021 14:17:31 +1200 Subject: [PATCH] Throw exception rather than fatal 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 --- Civi/Api4/Service/Spec/SpecGatherer.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Civi/Api4/Service/Spec/SpecGatherer.php b/Civi/Api4/Service/Spec/SpecGatherer.php index f9369d75ab..eee3974134 100644 --- a/Civi/Api4/Service/Spec/SpecGatherer.php +++ b/Civi/Api4/Service/Spec/SpecGatherer.php @@ -159,10 +159,13 @@ class SpecGatherer { * @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(); } -- 2.25.1