Error handling and schema validation improvements (#404)

This commit is contained in:
Vladimir Razuvaev 2019-06-19 18:58:51 +07:00
parent 84a52c6c76
commit ed1746e800
2 changed files with 5 additions and 3 deletions

View File

@ -259,10 +259,12 @@ class ReferenceExecutor implements ExecutorImplementation
return $result->then( return $result->then(
null, null,
function ($error) { function ($error) {
if ($error instanceof Error) {
$this->exeContext->addError($error); $this->exeContext->addError($error);
return $this->exeContext->promises->createFulfilled(null); return $this->exeContext->promises->createFulfilled(null);
} }
}
); );
} }

View File

@ -252,7 +252,7 @@ class SchemaValidationContext
if (! $type instanceof NamedType) { if (! $type instanceof NamedType) {
$this->reportError( $this->reportError(
'Expected GraphQL named type but got: ' . Utils::printSafe($type) . '.', 'Expected GraphQL named type but got: ' . Utils::printSafe($type) . '.',
is_object($type) ? $type->astNode : null $type instanceof Type ? $type->astNode : null
); );
continue; continue;
} }