示例#1
0
        private static void ReportErrors(
            NameString schemaName,
            IResolverContext context,
            IEnumerable <IError> errors)
        {
            foreach (IError error in errors)
            {
                IErrorBuilder builder = ErrorBuilder.FromError(error)
                                        .SetExtension(_remoteErrorField, error.RemoveException())
                                        .SetExtension(_schemaNameErrorField, schemaName.Value);

                if (error.Path != null)
                {
                    Path path = RewriteErrorPath(error, context.Path);
                    builder.SetPath(path)
                    .ClearLocations()
                    .AddLocation(context.FieldSelection);
                }
                else if (IsHttpError(error))
                {
                    builder.SetPath(context.Path)
                    .ClearLocations()
                    .AddLocation(context.FieldSelection);
                }

                context.ReportError(builder.Build());
            }
        }
示例#2
0
        private static void ReportErrors(
            IResolverContext context,
            IEnumerable <IError> errors)
        {
            foreach (IError error in errors)
            {
                IErrorBuilder builder = ErrorBuilder.FromError(error)
                                        .SetExtension("remote", error);

                if (error.Path != null)
                {
                    Path path = RewriteErrorPath(error, context.Path);
                    builder.SetPath(path)
                    .ClearLocations()
                    .AddLocation(context.FieldSelection);
                }

                context.ReportError(builder.Build());
            }
        }