mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-07 23:03:00 +03:00
Merge pull request #4320 from devdot/improve-api-auth-exception
Improve ApiAuthException control flow
This commit is contained in:
@@ -2,6 +2,25 @@
|
||||
|
||||
namespace BookStack\Exceptions;
|
||||
|
||||
class ApiAuthException extends UnauthorizedException
|
||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||
|
||||
class ApiAuthException extends \Exception implements HttpExceptionInterface
|
||||
{
|
||||
protected int $status;
|
||||
|
||||
public function __construct(string $message, int $statusCode = 401)
|
||||
{
|
||||
$this->status = $statusCode;
|
||||
parent::__construct($message, $statusCode);
|
||||
}
|
||||
|
||||
public function getStatusCode(): int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function getHeaders(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace BookStack\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class UnauthorizedException extends Exception
|
||||
{
|
||||
/**
|
||||
* ApiAuthException constructor.
|
||||
*/
|
||||
public function __construct($message, $code = 401)
|
||||
{
|
||||
parent::__construct($message, $code);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user