Attributes
4 weeks ago
Enums
2 months ago
Infrastructure
4 weeks ago
InputTypes
2 months ago
Interfaces
2 months ago
Mutations
2 months ago
Pagination
2 months ago
Queries
4 weeks ago
Scalars
2 months ago
Traits
2 months ago
Types
2 months ago
Utils
4 weeks ago
ApiException.php
2 months ago
ForbiddenException.php
4 weeks ago
InvalidTokenException.php
4 weeks ago
NotFoundException.php
4 weeks ago
UnauthorizedException.php
4 weeks ago
ValidationException.php
4 weeks ago
ForbiddenException.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Automattic\WooCommerce\Api; |
| 6 | |
| 7 | /** |
| 8 | * Thrown to signal that the caller is authenticated but lacks permission to |
| 9 | * perform the requested operation, e.g. the right user but the wrong role, |
| 10 | * scope, or capability. |
| 11 | * |
| 12 | * Use this for "I know who you are, but you can't do this." For "you need to |
| 13 | * authenticate first," prefer {@see UnauthorizedException}. |
| 14 | * |
| 15 | * Wire shape: `extensions.code = 'FORBIDDEN'`, HTTP status 403. |
| 16 | */ |
| 17 | class ForbiddenException extends ApiException { |
| 18 | /** |
| 19 | * Constructor. |
| 20 | * |
| 21 | * @param string $message The error message. |
| 22 | * @param array $extensions Additional error metadata to surface in the GraphQL `extensions` object. |
| 23 | * @param ?\Throwable $previous The previous throwable for chaining. |
| 24 | */ |
| 25 | public function __construct( |
| 26 | string $message = 'Forbidden.', |
| 27 | array $extensions = array(), |
| 28 | ?\Throwable $previous = null, |
| 29 | ) { |
| 30 | parent::__construct( $message, 'FORBIDDEN', $extensions, 403, $previous ); |
| 31 | } |
| 32 | } |
| 33 |