From 0443f5a811feb13ed8eb3628c351ab34ad8fca45 Mon Sep 17 00:00:00 2001 From: Dave M Date: Mon, 6 Jul 2026 13:41:35 +0000 Subject: [PATCH] - WIP on exceptions handling and throwing --- src/Exception/LeanApiException.php | 5 +++++ src/Exception/MandatoryFieldException.php | 2 +- src/Exception/MaximumLengthException.php | 2 +- src/Exception/MinimumLengthException.php | 2 +- src/Exception/RegexFormatException.php | 2 +- src/Form/Save.php | 7 ++++--- 6 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 src/Exception/LeanApiException.php diff --git a/src/Exception/LeanApiException.php b/src/Exception/LeanApiException.php new file mode 100644 index 0000000..b405bdd --- /dev/null +++ b/src/Exception/LeanApiException.php @@ -0,0 +1,5 @@ +object->assertValueSpecs($context->$name ?? null, ! $this->getEntity()->isLoaded()); - } - catch(\Throwable $ex) { - throw new MandatoryFieldException("An error occured with field '$name': " . $ex->getMessage()); + } catch (LeanApiException $e) { + throw new MandatoryFieldException("An error occured with field '$name': " . $e->getMessage()); } } }