src/Executor/Executor.php
protected static function resolveField(ExecutionContext $context, ObjectType $parent, $source, $asts)
    {
        $definition = self::getFieldDefinition($context->schema, $parent, $asts[0]);
        if (!$definition) {
            return self::$UNDEFINED;
        }

        // If the field type is non-nullable, then it is resolved without any
        // protection from errors.
        if ($definition->getType() instanceof NonNullModifier) {
            return self::resolveFieldOrError($context, $parent, $source, $asts, $definition);
        }

        // Otherwise, error protection is applied, logging the error and
        // resolving a null value for this field if one is encountered.
        try {
            $result = self::resolveFieldOrError($context, $parent, $source, $asts, $definition);
            return $result;
        } catch (\Exception $error) {
            $context->errors[] = $error;
            return NULL;
        }
    }
protected static function resolveField(ExecutionContext $context, ObjectType $parent, $source, $asts)
    {
        $definition = self::getFieldDefinition($context->schema, $parent, $asts[0]);
        if (!$definition) {
            return self::$UNDEFINED;
        }

        // If the field type is non-nullable, then it is resolved without any
        // protection from errors.
        if ($definition->getType() instanceof NonNullModifier) {
            return self::resolveFieldOrError($context, $parent, $source, $asts, $definition);
        }

        // Otherwise, error protection is applied, logging the error and
        // resolving a null value for this field if one is encountered.
        try {
            $result = self::resolveFieldOrError($context, $parent, $source, $asts, $definition);
            return $result;
        } catch (\Exception $error) {
            $context->errors[] = $error;
            return NULL;
        }
    }
protected static function resolveField ( ExecutionContext $ context , ObjectType $ parent , $ source , $ asts ) { $ definition = self :: getFieldDefinition ( $ context -> schema , $ parent , $ asts [ 0 ] ) ; if ( ! $ definition ) { return self :: $ UNDEFINED ; } // If the field type is non-nullable, then it is resolved without any // protection from errors. if ( $ definition -> getType ( ) instanceof NonNullModifier ) { return self :: resolveFieldOrError ( $ context , $ parent , $ source , $ asts , $ definition ) ; } // Otherwise, error protection is applied, logging the error and // resolving a null value for this field if one is encountered. try { $ result = self :: resolveFieldOrError ( $ context , $ parent , $ source , $ asts , $ definition ) ; return $ result ; } catch ( \ Exception $ error ) { $ context -> errors [ ] = $ error ; return NULL ; } }
A wrapper function for resolving the field, that catches the error
and adds it to the context's global if the error is not rethrowable.

@param ExecutionContext $context
@param ObjectType $parent
@param $source
@param $asts

@return array|mixed|null|string

@throws \Exception
A wrapper function for resolving the field that catches the error and adds it to the context s global if the error is not rethrowable .