Skip to content

Commit aec4367

Browse files
committed
fix(graphql): type loader needs to return null
1 parent 0400611 commit aec4367

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/GraphQl/Type/SchemaBuilder.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ public function getSchema(): Schema
8787

8888
$schema = [
8989
'query' => $queryType,
90-
'typeLoader' => function (string $typeName): Type&NamedType {
91-
$type = $this->typesContainer->get($typeName);
90+
'typeLoader' => function (string $typeName): ?NamedType {
91+
try {
92+
$type = $this->typesContainer->get($typeName);
93+
} catch (TypeNotFoundException) {
94+
return null;
95+
}
9296

9397
return Type::getNamedType($type);
9498
},

0 commit comments

Comments
 (0)