Merge pull request #281 from icerockdev/master

Removing data elements from response if the error throwing
This commit is contained in:
Vladimir Razuvaev 2018-05-27 20:02:14 +07:00 committed by GitHub
commit 9452655fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -311,7 +311,10 @@ class Executor
return null;
})
->then(function ($data) {
return new ExecutionResult((array) $data, $this->exeContext->errors);
if ($data !== null){
$data = (array) $data;
}
return new ExecutionResult($data, $this->exeContext->errors);
});
}

View File

@ -732,7 +732,6 @@ class NonNullTest extends \PHPUnit_Framework_TestCase
';
$expected = [
'data' => null,
'errors' => [
FormattedError::create($this->nonNullSyncError->getMessage(), [new SourceLocation(2, 17)])
]
@ -750,7 +749,6 @@ class NonNullTest extends \PHPUnit_Framework_TestCase
$ast = Parser::parse($doc);
$expected = [
'data' => null,
'errors' => [
FormattedError::create($this->nonNullPromiseError->getMessage(), [new SourceLocation(2, 17)]),
]
@ -789,7 +787,6 @@ class NonNullTest extends \PHPUnit_Framework_TestCase
$ast = Parser::parse($doc);
$expected = [
'data' => null,
'errors' => [
[
'debugMessage' => 'Cannot return null for non-nullable field DataType.nonNullPromise.',