|
|
@@ -9,7 +9,7 @@ use ApiPlatform\Metadata\Exception\ProblemExceptionInterface;
|
|
|
* Thrown when a requested resource (cart, product, item, etc.) is not found.
|
|
|
* Maps to HTTP 404 in REST and an `errors[]` entry in GraphQL.
|
|
|
*/
|
|
|
-class ResourceNotFoundException extends \Exception implements \GraphQL\Error\ClientAware, HttpExceptionInterface, ProblemExceptionInterface
|
|
|
+class ResourceNotFoundException extends \Exception implements \GraphQL\Error\ClientAware, HttpExceptionInterface, ProblemExceptionInterface, \GraphQL\Error\ProvidesExtensions
|
|
|
{
|
|
|
private int $status = 404;
|
|
|
|
|
|
@@ -19,6 +19,14 @@ class ResourceNotFoundException extends \Exception implements \GraphQL\Error\Cli
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
+ public function getExtensions(): array
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ 'code' => 'RESOURCE_NOT_FOUND',
|
|
|
+ 'category' => $this->getCategory(),
|
|
|
+ 'status' => $this->getStatus()
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
public function getCategory(): string
|
|
|
{
|