diff --git a/src/Core/DB/DB.php b/src/Core/DB/DB.php index ec9236ea5d..a4c5fea12d 100644 --- a/src/Core/DB/DB.php +++ b/src/Core/DB/DB.php @@ -1,6 +1,7 @@ . + // }}} /** @@ -30,13 +32,13 @@ namespace App\Core\DB; +use App\Util\Exception\NotFoundException; use App\Util\Formatting; use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\ExpressionBuilder; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query; use Doctrine\ORM\Query\ResultSetMappingBuilder; -use Exception; abstract class DB { @@ -117,7 +119,7 @@ abstract class DB if (count($res) == 1) { return $res[0]; } else { - throw new Exception("No value in table {$table} matches the requested criteria"); + throw new NotFoundException("No value in table {$table} matches the requested criteria"); } } diff --git a/src/Util/Exception/NotFoundException.php b/src/Util/Exception/NotFoundException.php new file mode 100644 index 0000000000..8e4a714bc3 --- /dev/null +++ b/src/Util/Exception/NotFoundException.php @@ -0,0 +1,30 @@ +. + +// }}} + +namespace App\Util\Exception; + +class NotFoundException extends ServerException +{ + public function __construct(string $m) + { + parent::__construct($m); + } +}