mirror of
https://github.com/flarum/framework.git
synced 2024-12-03 07:33:36 +08:00
Make existing extensions compatible with new stack
This commit is contained in:
parent
1e5c7e54ee
commit
2c231aa475
|
@ -10,7 +10,12 @@
|
|||
namespace Flarum\Api\Exception;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Foundation\KnownError;
|
||||
|
||||
class InvalidAccessTokenException extends Exception
|
||||
class InvalidAccessTokenException extends Exception implements KnownError
|
||||
{
|
||||
public function getType(): string
|
||||
{
|
||||
return 'invalid_access_token';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
namespace Flarum\Http\Exception;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Foundation\KnownError;
|
||||
|
||||
class ForbiddenException extends Exception
|
||||
class ForbiddenException extends Exception implements KnownError
|
||||
{
|
||||
public function __construct($message = null, $code = 403, Exception $previous = null)
|
||||
public function getType(): string
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
return 'forbidden';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
namespace Flarum\Http\Exception;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Foundation\KnownError;
|
||||
|
||||
class MethodNotAllowedException extends Exception
|
||||
class MethodNotAllowedException extends Exception implements KnownError
|
||||
{
|
||||
public function __construct($message = null, $code = 405, Exception $previous = null)
|
||||
public function getType(): string
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
return 'method_not_allowed';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
namespace Flarum\Http\Exception;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Foundation\KnownError;
|
||||
|
||||
class RouteNotFoundException extends Exception
|
||||
class RouteNotFoundException extends Exception implements KnownError
|
||||
{
|
||||
public function __construct($message = null, $code = 404, Exception $previous = null)
|
||||
public function getType(): string
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
return 'route_not_found';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
namespace Flarum\Http\Exception;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Foundation\KnownError;
|
||||
|
||||
class TokenMismatchException extends Exception
|
||||
class TokenMismatchException extends Exception implements KnownError
|
||||
{
|
||||
public function __construct($message = null, $code = 419, Exception $previous = null)
|
||||
public function getType(): string
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
return 'csrf_token_mismatch';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,12 @@
|
|||
namespace Flarum\Post\Exception;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Foundation\KnownError;
|
||||
|
||||
class FloodingException extends Exception
|
||||
class FloodingException extends Exception implements KnownError
|
||||
{
|
||||
public function getType(): string
|
||||
{
|
||||
return 'too_many_requests';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,12 @@
|
|||
namespace Flarum\User\Exception;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Foundation\KnownError;
|
||||
|
||||
class InvalidConfirmationTokenException extends Exception
|
||||
class InvalidConfirmationTokenException extends Exception implements KnownError
|
||||
{
|
||||
public function getType(): string
|
||||
{
|
||||
return 'invalid_confirmation_token';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
namespace Flarum\User\Exception;
|
||||
|
||||
use Exception;
|
||||
use Flarum\Foundation\KnownError;
|
||||
|
||||
class PermissionDeniedException extends Exception
|
||||
class PermissionDeniedException extends Exception implements KnownError
|
||||
{
|
||||
public function __construct($message = null, $code = 403, Exception $previous = null)
|
||||
public function getType(): string
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
return 'permission_denied';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user