From e35d11853b5a8cebeb5fc245f25d2c9b3e64b19d Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Thu, 14 Nov 2024 13:39:54 +0100 Subject: [PATCH] Throw exception when saving afforms with mandatory values missing --- ext/afform/core/Civi/Api4/Action/Afform/Submit.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/afform/core/Civi/Api4/Action/Afform/Submit.php b/ext/afform/core/Civi/Api4/Action/Afform/Submit.php index d7f0dbe0141..6a0fc50f0cb 100644 --- a/ext/afform/core/Civi/Api4/Action/Afform/Submit.php +++ b/ext/afform/core/Civi/Api4/Action/Afform/Submit.php @@ -353,6 +353,9 @@ public static function processGenericEntity(AfformSubmitEvent $event) { // What to do here? Sometimes we should silently ignore errors, e.g. an optional entity // intentionally left blank. Other times it's a real error the user should know about. \Civi::log('afform')->debug('Silently ignoring exception in Afform processGenericEntity call for "' . $event->getEntityName() . '". Message: ' . $e->getMessage()); + if ('mandatory_missing' === $e->getErrorCode()) { + throw $e; + } } } }