GraphQL\Executor\Executor::completeValueWithLocatedError PHP Method

completeValueWithLocatedError() public static method

This is a small wrapper around completeValue which annotates errors with location information.
public static completeValueWithLocatedError ( ExecutionContext $exeContext, Type $returnType, $fieldNodes, ResolveInfo $info, $path, $result ) : array | null | GraphQL\Executor\Promise\Promise
$exeContext ExecutionContext
$returnType GraphQL\Type\Definition\Type
$fieldNodes
$info GraphQL\Type\Definition\ResolveInfo
$path
$result
return array | null | GraphQL\Executor\Promise\Promise
    public static function completeValueWithLocatedError(ExecutionContext $exeContext, Type $returnType, $fieldNodes, ResolveInfo $info, $path, $result)
    {
        try {
            $completed = self::completeValue($exeContext, $returnType, $fieldNodes, $info, $path, $result);
            if (self::$promiseAdapter->isPromise($completed)) {
                return $completed->then(null, function ($error) use($fieldNodes, $path) {
                    return self::$promiseAdapter->createRejectedPromise(Error::createLocatedError($error, $fieldNodes, $path));
                });
            }
            return $completed;
        } catch (\Exception $error) {
            throw Error::createLocatedError($error, $fieldNodes, $path);
        }
    }