-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: RecursiveTypeMapper returns exception which can't be handled by …
…StandardServer (#646) * fix: RecursiveTypeMapper returns exception which can't be handled by StandardServer RecursiveTypeMapper throws CannotMapTypeException when fails to find class by name. This exception goes through the GraphQl executor instead of catching and wrapping into ExecutionResult. Non wrapped exception does not trigger HttpCodeDecider. Schema test trust more to input than configuration which is not optimal, great possibility to improve configuration validation. Fixes: #336 * feat: new special Exception class when request type unknown Fixes: #336 * fix: move asserts Fixes: #336 * polish changes Fixes: #336
- Loading branch information
Showing
4 changed files
with
70 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TheCodingMachine\GraphQLite\Mappers; | ||
|
||
use GraphQL\Error\Error; | ||
use GraphQL\Utils\Utils; | ||
|
||
/** | ||
* TypeNotFoundException thrown when RecursiveTypeMapper fails to find a type. | ||
* | ||
* While CannotMapTypeException is more about error with configuration this exception can occur when request | ||
* contains a type which is unknown to the server. | ||
* Should not be handled by the user, webonyx/graphql-php will transform this under 'errors' key in the response. | ||
*/ | ||
class TypeNotFoundException extends Error | ||
{ | ||
public static function createError(string $typeName): Error | ||
{ | ||
return static::createLocatedError('Unknown type ' . Utils::printSafe($typeName)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters