From f6b6776c93a4fd8934372b22229ea77b4f8bfc54 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 27 Nov 2023 17:59:14 +0100 Subject: fix(API): Use a distinct exception so apps can react to it and customize the return Signed-off-by: Joas Schilling --- lib/private/AppFramework/Http/Dispatcher.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/private/AppFramework/Http') diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php index 5649060ba76..6e946f2bfa3 100644 --- a/lib/private/AppFramework/Http/Dispatcher.php +++ b/lib/private/AppFramework/Http/Dispatcher.php @@ -38,11 +38,11 @@ use OC\AppFramework\Utility\ControllerMethodReflector; use OC\DB\ConnectionAdapter; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\Http\ParameterOutOfRangeException; use OCP\AppFramework\Http\Response; use OCP\Diagnostics\IEventLogger; use OCP\IConfig; use OCP\IRequest; -use OutOfRangeException; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; @@ -255,18 +255,18 @@ class Dispatcher { /** * @psalm-param mixed $value - * @throws OutOfRangeException + * @throws ParameterOutOfRangeException */ private function ensureParameterValueSatisfiesRange(string $param, $value): void { $rangeInfo = $this->reflector->getRange($param); if ($rangeInfo) { if ($value < $rangeInfo['min'] || $value > $rangeInfo['max']) { - throw new OutOfRangeException(sprintf( - 'Parameter %s must be between %d and %d', + throw new ParameterOutOfRangeException( $param, + $value, $rangeInfo['min'], $rangeInfo['max'], - )); + ); } } } -- cgit v1.2.3