From af106fe4fe28feff2efd668abba391382abc280f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20G=C3=BCttler?= Date: Wed, 8 Mar 2023 15:02:03 +0100 Subject: [PATCH] Use NotFoundException instead \Exception, if a value could not be retrieved --- Classes/Exception/NotFoundException.php | 9 +++++++++ Classes/ObjectAccess.php | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 Classes/Exception/NotFoundException.php diff --git a/Classes/Exception/NotFoundException.php b/Classes/Exception/NotFoundException.php new file mode 100644 index 0000000..65f687b --- /dev/null +++ b/Classes/Exception/NotFoundException.php @@ -0,0 +1,9 @@ + * */ - - class ObjectAccess { /** @@ -77,7 +78,7 @@ public static function get($object, $query, $default = null){ public static function getOrThrowException($object, $query){ $value = self::get($object,$query); if($value === null){ - throw new \Exception('Could Not Retrieve '.$query); + throw new NotFoundException('Could Not Retrieve '.$query); } return $value; }