mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-29 08:26:02 +03:00
Removing data elements from response if the error throwing
This commit is contained in:
parent
ec0985619f
commit
c7f114d90b
@ -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