Automattic\WooCommerce\Vendor\GraphQL\Executor
ReferenceExecutor::handleFieldError
Method of the class: ReferenceExecutor{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->handleFieldError( $rawError, $fieldNodes, $path, $unaliasedPath, $returnType ): void;
- $rawError(mixed) (required)
- .
- $fieldNodes(ArrayObject) (required)
- .
- $path(list<string|int>) (required)
- .
- $unaliasedPath(list<string|int>) (required)
- .
- $returnType(Type) (required)
- .
ReferenceExecutor::handleFieldError() ReferenceExecutor::handleFieldError code WC 10.9.1
protected function handleFieldError($rawError, \ArrayObject $fieldNodes, array $path, array $unaliasedPath, Type $returnType): void
{
$error = Error::createLocatedError(
$rawError,
$fieldNodes,
$path,
$unaliasedPath
);
// If the field type is non-nullable, then it is resolved without any
// protection from errors, however it still properly locates the error.
if ($returnType instanceof NonNull) {
throw $error;
}
// Otherwise, error protection is applied, logging the error and resolving
// a null value for this field if one is encountered.
$this->exeContext->addError($error);
}