summaryrefslogtreecommitdiffstats
path: root/lib/private/AppFramework/Http
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-11-27 17:59:14 +0100
committerJoas Schilling <coding@schilljs.com>2023-11-28 06:11:57 +0100
commitf6b6776c93a4fd8934372b22229ea77b4f8bfc54 (patch)
tree49ce81c4a306084a59db2d83de99ab27ac4aea29 /lib/private/AppFramework/Http
parentc13b748dea32ac932fabc9e681a17ef0ffdbf478 (diff)
downloadnextcloud-server-f6b6776c93a4fd8934372b22229ea77b4f8bfc54.tar.gz
nextcloud-server-f6b6776c93a4fd8934372b22229ea77b4f8bfc54.zip
fix(API): Use a distinct exception so apps can react to it and customize the return
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/AppFramework/Http')
-rw-r--r--lib/private/AppFramework/Http/Dispatcher.php10
1 files changed, 5 insertions, 5 deletions
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'],
- ));
+ );
}
}
}