mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
Add use Throwable
This commit is contained in:
parent
d64fb3f526
commit
f6c1070ccc
@ -11,6 +11,7 @@ namespace League\OAuth2\Server\Exception;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
class OAuthServerException extends Exception
|
class OAuthServerException extends Exception
|
||||||
{
|
{
|
||||||
@ -48,9 +49,9 @@ class OAuthServerException extends Exception
|
|||||||
* @param int $httpStatusCode HTTP status code to send (default = 400)
|
* @param int $httpStatusCode HTTP status code to send (default = 400)
|
||||||
* @param null|string $hint A helper hint
|
* @param null|string $hint A helper hint
|
||||||
* @param null|string $redirectUri A HTTP URI to redirect the user back to
|
* @param null|string $redirectUri A HTTP URI to redirect the user back to
|
||||||
* @param \Throwable $previous Previous exception
|
* @param Throwable $previous Previous exception
|
||||||
*/
|
*/
|
||||||
public function __construct($message, $code, $errorType, $httpStatusCode = 400, $hint = null, $redirectUri = null, \Throwable $previous = null)
|
public function __construct($message, $code, $errorType, $httpStatusCode = 400, $hint = null, $redirectUri = null, Throwable $previous = null)
|
||||||
{
|
{
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
$this->httpStatusCode = $httpStatusCode;
|
$this->httpStatusCode = $httpStatusCode;
|
||||||
@ -104,11 +105,11 @@ class OAuthServerException extends Exception
|
|||||||
*
|
*
|
||||||
* @param string $parameter The invalid parameter
|
* @param string $parameter The invalid parameter
|
||||||
* @param null|string $hint
|
* @param null|string $hint
|
||||||
* @param \Throwable $previous Previous exception
|
* @param Throwable $previous Previous exception
|
||||||
*
|
*
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function invalidRequest($parameter, $hint = null, \Throwable $previous = null)
|
public static function invalidRequest($parameter, $hint = null, Throwable $previous = null)
|
||||||
{
|
{
|
||||||
$errorMessage = 'The request is missing a required parameter, includes an invalid parameter value, ' .
|
$errorMessage = 'The request is missing a required parameter, includes an invalid parameter value, ' .
|
||||||
'includes a parameter more than once, or is otherwise malformed.';
|
'includes a parameter more than once, or is otherwise malformed.';
|
||||||
@ -167,13 +168,13 @@ class OAuthServerException extends Exception
|
|||||||
* Server error.
|
* Server error.
|
||||||
*
|
*
|
||||||
* @param string $hint
|
* @param string $hint
|
||||||
* @param \Throwable $previous
|
* @param Throwable $previous
|
||||||
*
|
*
|
||||||
* @return static
|
* @return static
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public static function serverError($hint, \Throwable $previous = null)
|
public static function serverError($hint, Throwable $previous = null)
|
||||||
{
|
{
|
||||||
return new static(
|
return new static(
|
||||||
'The authorization server encountered an unexpected condition which prevented it from fulfilling'
|
'The authorization server encountered an unexpected condition which prevented it from fulfilling'
|
||||||
@ -189,11 +190,11 @@ class OAuthServerException extends Exception
|
|||||||
* Invalid refresh token.
|
* Invalid refresh token.
|
||||||
*
|
*
|
||||||
* @param null|string $hint
|
* @param null|string $hint
|
||||||
* @param \Throwable $previous
|
* @param Throwable $previous
|
||||||
*
|
*
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function invalidRefreshToken($hint = null, \Throwable $previous = null)
|
public static function invalidRefreshToken($hint = null, Throwable $previous = null)
|
||||||
{
|
{
|
||||||
return new static('The refresh token is invalid.', 8, 'invalid_request', 401, $hint, null, $previous);
|
return new static('The refresh token is invalid.', 8, 'invalid_request', 401, $hint, null, $previous);
|
||||||
}
|
}
|
||||||
@ -203,11 +204,11 @@ class OAuthServerException extends Exception
|
|||||||
*
|
*
|
||||||
* @param null|string $hint
|
* @param null|string $hint
|
||||||
* @param null|string $redirectUri
|
* @param null|string $redirectUri
|
||||||
* @param \Throwable $previous
|
* @param Throwable $previous
|
||||||
*
|
*
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function accessDenied($hint = null, $redirectUri = null, \Throwable $previous = null)
|
public static function accessDenied($hint = null, $redirectUri = null, Throwable $previous = null)
|
||||||
{
|
{
|
||||||
return new static(
|
return new static(
|
||||||
'The resource owner or authorization server denied the request.',
|
'The resource owner or authorization server denied the request.',
|
||||||
|
Loading…
Reference in New Issue
Block a user