mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 12:56:05 +03:00
Removing data elements from response if the error throwing
(cherry picked from commit c7f114d
)
This commit is contained in:
parent
01e084a9ee
commit
63b04df6ef
@ -311,7 +311,10 @@ class Executor
|
|||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
->then(function ($data) {
|
->then(function ($data) {
|
||||||
return new ExecutionResult((array) $data, $this->exeContext->errors);
|
if ($data === null){
|
||||||
|
$data = (array) $data;
|
||||||
|
}
|
||||||
|
return new ExecutionResult($data, $this->exeContext->errors);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,7 +732,6 @@ class NonNullTest extends \PHPUnit_Framework_TestCase
|
|||||||
';
|
';
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
'data' => null,
|
|
||||||
'errors' => [
|
'errors' => [
|
||||||
FormattedError::create($this->nonNullSyncError->getMessage(), [new SourceLocation(2, 17)])
|
FormattedError::create($this->nonNullSyncError->getMessage(), [new SourceLocation(2, 17)])
|
||||||
]
|
]
|
||||||
@ -750,7 +749,6 @@ class NonNullTest extends \PHPUnit_Framework_TestCase
|
|||||||
$ast = Parser::parse($doc);
|
$ast = Parser::parse($doc);
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
'data' => null,
|
|
||||||
'errors' => [
|
'errors' => [
|
||||||
FormattedError::create($this->nonNullPromiseError->getMessage(), [new SourceLocation(2, 17)]),
|
FormattedError::create($this->nonNullPromiseError->getMessage(), [new SourceLocation(2, 17)]),
|
||||||
]
|
]
|
||||||
@ -789,7 +787,6 @@ class NonNullTest extends \PHPUnit_Framework_TestCase
|
|||||||
$ast = Parser::parse($doc);
|
$ast = Parser::parse($doc);
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
'data' => null,
|
|
||||||
'errors' => [
|
'errors' => [
|
||||||
[
|
[
|
||||||
'debugMessage' => 'Cannot return null for non-nullable field DataType.nonNullPromise.',
|
'debugMessage' => 'Cannot return null for non-nullable field DataType.nonNullPromise.',
|
||||||
|
Loading…
Reference in New Issue
Block a user