diff --git a/src/Exceptions/GraphQLException.php b/src/Exceptions/GraphQLException.php index c874291a5c..c6afc58a4c 100644 --- a/src/Exceptions/GraphQLException.php +++ b/src/Exceptions/GraphQLException.php @@ -14,7 +14,6 @@ public function __construct( string $message, int $code = 0, Throwable|null $previous = null, - protected string $category = 'Exception', protected array $extensions = [], ) { parent::__construct($message, $code, $previous); @@ -28,16 +27,6 @@ public function isClientSafe(): bool return true; } - /** - * Returns string describing a category of the error. - * - * Value "graphql" is reserved for errors produced by query parsing or validation, do not use it. - */ - public function getCategory(): string - { - return $this->category; - } - /** * Returns the "extensions" object attached to the GraphQL error. * diff --git a/src/Mappers/PorpaginasMissingParameterException.php b/src/Mappers/PorpaginasMissingParameterException.php index 1af433520f..afb40e377d 100644 --- a/src/Mappers/PorpaginasMissingParameterException.php +++ b/src/Mappers/PorpaginasMissingParameterException.php @@ -28,14 +28,4 @@ public function isClientSafe(): bool { return true; } - - /** - * Returns string describing a category of the error. - * - * Value "graphql" is reserved for errors produced by query parsing or validation, do not use it. - */ - public function getCategory(): string - { - return 'pagination'; - } } diff --git a/src/Middlewares/MissingAuthorizationException.php b/src/Middlewares/MissingAuthorizationException.php index e04edd2d6d..4b9a4758c6 100644 --- a/src/Middlewares/MissingAuthorizationException.php +++ b/src/Middlewares/MissingAuthorizationException.php @@ -26,14 +26,4 @@ public function isClientSafe(): bool { return true; } - - /** - * Returns string describing a category of the error. - * - * Value "graphql" is reserved for errors produced by query parsing or validation, do not use it. - */ - public function getCategory(): string - { - return 'security'; - } } diff --git a/src/Parameters/MissingArgumentException.php b/src/Parameters/MissingArgumentException.php index be48cd5564..d906f8063f 100644 --- a/src/Parameters/MissingArgumentException.php +++ b/src/Parameters/MissingArgumentException.php @@ -81,16 +81,6 @@ public function isClientSafe(): bool return true; } - /** - * Returns string describing a category of the error. - * - * Value "graphql" is reserved for errors produced by query parsing or validation, do not use it. - */ - public function getCategory(): string - { - return 'graphql'; - } - /** * Returns the "extensions" object attached to the GraphQL error. * diff --git a/tests/Exceptions/ErrorHandlerTest.php b/tests/Exceptions/ErrorHandlerTest.php index 637499ec57..9c20b86d38 100644 --- a/tests/Exceptions/ErrorHandlerTest.php +++ b/tests/Exceptions/ErrorHandlerTest.php @@ -10,7 +10,7 @@ class ErrorHandlerTest extends TestCase public function testErrorFormatter() { - $exception = new GraphQLException('foo', 0, null, 'MyCategory', ['field' => 'foo']); + $exception = new GraphQLException('foo', 0, null, ['field' => 'foo']); $error = new Error('foo', null, null, [], null, $exception); $formattedError = WebonyxErrorHandler::errorFormatter($error); $this->assertSame([ @@ -23,7 +23,7 @@ public function testErrorFormatter() public function testErrorHandler() { - $exception = new GraphQLException('foo', 0, null, 'MyCategory', ['field' => 'foo']); + $exception = new GraphQLException('foo', 0, null, ['field' => 'foo']); $error = new Error('bar', null, null, [], null, $exception); $aggregateException = new GraphQLAggregateException(); $aggregateException->add($exception); diff --git a/tests/Http/HttpCodeDeciderTest.php b/tests/Http/HttpCodeDeciderTest.php index dd82364c74..d7a0629da5 100644 --- a/tests/Http/HttpCodeDeciderTest.php +++ b/tests/Http/HttpCodeDeciderTest.php @@ -38,11 +38,6 @@ public function isClientSafe():bool { return true; } - - public function getCategory() - { - return 'foo'; - } }; $clientAwareError = new Error('Foo', null, null, [], null, $clientAwareException); diff --git a/tests/Parameters/MissingArgumentExceptionTest.php b/tests/Parameters/MissingArgumentExceptionTest.php index 9c0ba460f0..c4b7eec3dc 100644 --- a/tests/Parameters/MissingArgumentExceptionTest.php +++ b/tests/Parameters/MissingArgumentExceptionTest.php @@ -21,6 +21,5 @@ public function testWrapWithFactoryContext(): void $this->assertTrue($e->isClientSafe()); $this->assertSame([], $e->getExtensions()); - $this->assertSame('graphql', $e->getCategory()); } } diff --git a/website/docs/error-handling.mdx b/website/docs/error-handling.mdx index 549a9c15c9..1fe32a54de 100644 --- a/website/docs/error-handling.mdx +++ b/website/docs/error-handling.mdx @@ -12,10 +12,7 @@ In GraphQL, when an error occurs, the server must add an "error" entry in the re { "message": "Name for character with ID 1002 could not be fetched.", "locations": [ { "line": 6, "column": 7 } ], - "path": [ "hero", "heroFriends", 1, "name" ], - "extensions": { - "category": "Exception" - } + "path": [ "hero", "heroFriends", 1, "name" ] } ] } @@ -43,30 +40,6 @@ throw new GraphQLException("Not found", 404);
GraphQLException thrown for the same request, the HTTP status code used will be the highest one.