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
NotFoundException.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 requested resource doesn't exist. |
| 9 | * |
| 10 | * Note: when the existence of a resource is itself sensitive (e.g. an order |
| 11 | * the caller has no business knowing about), prefer {@see UnauthorizedException} |
| 12 | * instead: leaking a 404 vs 401 distinction lets callers probe for resource |
| 13 | * existence. |
| 14 | * |
| 15 | * Wire shape: `extensions.code = 'NOT_FOUND'`, HTTP status 404. |
| 16 | */ |
| 17 | class NotFoundException 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 = 'Resource not found.', |
| 27 | array $extensions = array(), |
| 28 | ?\Throwable $previous = null, |
| 29 | ) { |
| 30 | parent::__construct( $message, 'NOT_FOUND', $extensions, 404, $previous ); |
| 31 | } |
| 32 | } |
| 33 |