mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 15:59:24 +03:00
Fixed reported path for error; deprecated old FormattedError tool
This commit is contained in:
parent
2369454687
commit
c25a29213c
@ -95,7 +95,7 @@ class Error extends \Exception implements \JsonSerializable
|
||||
*/
|
||||
public static function formatError(Error $error)
|
||||
{
|
||||
return FormattedError::create($error->getMessage(), $error->getLocations());
|
||||
return $error->toSerializableArray();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -179,7 +179,10 @@ class Error extends \Exception implements \JsonSerializable
|
||||
'message' => $this->getMessage(),
|
||||
];
|
||||
|
||||
$locations = Utils::map($this->getLocations(), function(SourceLocation $loc) {return $loc->toArray();});
|
||||
$locations = Utils::map($this->getLocations(), function(SourceLocation $loc) {
|
||||
return $loc->toSerializableArray();
|
||||
});
|
||||
|
||||
if (!empty($locations)) {
|
||||
$arr['locations'] = $locations;
|
||||
}
|
||||
|
@ -222,8 +222,9 @@ class Executor
|
||||
{
|
||||
$results = [];
|
||||
foreach ($fields as $responseName => $fieldASTs) {
|
||||
$path[] = $responseName;
|
||||
$result = self::resolveField($exeContext, $parentType, $sourceValue, $fieldASTs, $path);
|
||||
$fieldPath = $path;
|
||||
$fieldPath[] = $responseName;
|
||||
$result = self::resolveField($exeContext, $parentType, $sourceValue, $fieldASTs, $fieldPath);
|
||||
|
||||
if ($result !== self::$UNDEFINED) {
|
||||
// Undefined means that field is not defined in schema
|
||||
|
@ -6,6 +6,7 @@ use GraphQL\Language\SourceLocation;
|
||||
class FormattedError
|
||||
{
|
||||
/**
|
||||
* @deprecated since 2016-10-21
|
||||
* @param $error
|
||||
* @param SourceLocation[] $locations
|
||||
* @return array
|
||||
|
Loading…
x
Reference in New Issue
Block a user