From ed1746e800637eebf8529530ab208fcafb7214ac Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Wed, 19 Jun 2019 18:58:51 +0700 Subject: [PATCH] Error handling and schema validation improvements (#404) --- src/Executor/ReferenceExecutor.php | 6 ++++-- src/Type/SchemaValidationContext.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Executor/ReferenceExecutor.php b/src/Executor/ReferenceExecutor.php index 001dbd5..6e35f7c 100644 --- a/src/Executor/ReferenceExecutor.php +++ b/src/Executor/ReferenceExecutor.php @@ -259,9 +259,11 @@ class ReferenceExecutor implements ExecutorImplementation return $result->then( null, function ($error) { - $this->exeContext->addError($error); + if ($error instanceof Error) { + $this->exeContext->addError($error); - return $this->exeContext->promises->createFulfilled(null); + return $this->exeContext->promises->createFulfilled(null); + } } ); } diff --git a/src/Type/SchemaValidationContext.php b/src/Type/SchemaValidationContext.php index f00d3e5..5e52164 100644 --- a/src/Type/SchemaValidationContext.php +++ b/src/Type/SchemaValidationContext.php @@ -252,7 +252,7 @@ class SchemaValidationContext if (! $type instanceof NamedType) { $this->reportError( 'Expected GraphQL named type but got: ' . Utils::printSafe($type) . '.', - is_object($type) ? $type->astNode : null + $type instanceof Type ? $type->astNode : null ); continue; }