api(app): more consistent handling of per_page query param
This commit is contained in:
parent
49de31bf4c
commit
c521d37ddd
10 changed files with 71 additions and 42 deletions
21
app/Exceptions/Http/QueryValueOutOfRangeHttpException.php
Normal file
21
app/Exceptions/Http/QueryValueOutOfRangeHttpException.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Exceptions\Http;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class QueryValueOutOfRangeHttpException extends HttpException
|
||||
{
|
||||
/**
|
||||
* QueryValueOutOfRangeHttpException constructor.
|
||||
*/
|
||||
public function __construct(string $name, int $min, int $max, \Throwable $previous = null)
|
||||
{
|
||||
parent::__construct(
|
||||
Response::HTTP_BAD_REQUEST,
|
||||
'\"' . $name . '\" query parameter must be between ' . $min . ' and ' . $max,
|
||||
$previous,
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue