protected static function resolveFieldOrError(ExecutionContext $context, ObjectType $parent, $source, $asts, FieldDefinition $definition)
    {
        $ast = $asts[0];
        $type = $definition->getType();
        $resolver = $definition->getResolveCallback() ?: [__CLASS__, 'defaultResolveFn'];
        $data = $definition->getResolveData();
        $args = Values::getArgumentValues($definition->getArguments(), $ast->get('arguments'), $context->variables);

        try {
            // @todo Change the resolver function syntax to use a value object.
            $result = call_user_func($resolver, $source, $args, $context->root, $ast, $type, $parent, $context->schema, $data);
        } catch (\Exception $error) {
            throw $error;
        }

        return self::completeField($context, $type, $asts, $result);
    }