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;
        }
    }