Exemplo n.º 1
0
        private ErrorNode CreateError(Token tok, ErrorResourceKey errKey)
        {
            Contracts.AssertValue(tok);

            var err = PostError(tok, errKey);

            return(new ErrorNode(ref _idNext, tok, err.ShortMessage));
        }
Exemplo n.º 2
0
 public TexlError Error(TexlNode node, ErrorResourceKey errKey, params object[] args)
 {
     if (DefaultSeverity <= maximumSeverity)
     {
         return(errors.Error(node, errKey, args));
     }
     return(null);
 }
Exemplo n.º 3
0
 public TexlError Error(DocumentErrorSeverity severity, TexlNode node, ErrorResourceKey errKey, params object[] args)
 {
     if (severity <= this.maximumSeverity)
     {
         return(errors.Error(severity, node, errKey, args));
     }
     return(null);
 }
Exemplo n.º 4
0
        private TexlError PostError(Token tok, ErrorResourceKey errKey)
        {
            Contracts.AssertValue(tok);
            Contracts.AssertValue(errKey.Key);

            TexlError err = new TexlError(tok, DocumentErrorSeverity.Critical, errKey);

            CollectionUtils.Add(ref _errors, err);
            return(err);
        }
Exemplo n.º 5
0
        public TexlError(Token tok, DocumentErrorSeverity severity, ErrorResourceKey errKey, params object[] args)
            : base(null, null, DocumentErrorKind.AXL, severity, errKey, args)
        {
            Contracts.AssertValue(tok);

            Tok      = tok;
            TextSpan = new Span(tok.VerifyValue().Span.Min, tok.VerifyValue().Span.Lim);

            _nameMapIDs = new List <string>();
        }
Exemplo n.º 6
0
        public TexlError Error(DocumentErrorSeverity severity, TexlNode node, ErrorResourceKey errKey, params object[] args)
        {
            Contracts.AssertValue(node);
            Contracts.AssertValue(args);

            TexlError err = new TexlError(node, severity, errKey, args);

            CollectionUtils.Add(ref _errors, err);
            return(err);
        }
Exemplo n.º 7
0
        public TexlError(TexlNode node, DocumentErrorSeverity severity, ErrorResourceKey errKey, params object[] args)
            : base(null, null, DocumentErrorKind.AXL, severity, errKey, args)
        {
            Contracts.AssertValue(node);
            Contracts.AssertValue(node.Token);

            Node     = node;
            Tok      = node.Token;
            TextSpan = node.GetTextSpan();

            _nameMapIDs = new List <string>();
        }
Exemplo n.º 8
0
        public TexlError EnsureError(DocumentErrorSeverity severity, TexlNode node, ErrorResourceKey errKey, params object[] args)
        {
            Contracts.AssertValue(node);
            Contracts.AssertValue(args);

            if (!HasErrors(node, severity))
            {
                return(Error(severity, node, errKey, args));
            }

            return(null);
        }
Exemplo n.º 9
0
 public TexlError Error(DocumentErrorSeverity severity, TexlNode node, ErrorResourceKey errKey, params object[] args)
 {
     return(null);
 }
Exemplo n.º 10
0
 public TexlError Error(TexlNode node, ErrorResourceKey errKey, params object[] args)
 {
     return(null);
 }
Exemplo n.º 11
0
        internal BaseError(IDocumentError innerError, Exception internalException, DocumentErrorKind kind, DocumentErrorSeverity severity, ErrorResourceKey errKey, Span textSpan, IEnumerable <string> sinkTypeErrors, params object[] args)
        {
            Contracts.AssertValueOrNull(innerError);
            Contracts.AssertValueOrNull(args);
            Contracts.AssertValueOrNull(internalException);
            Contracts.AssertValueOrNull(textSpan);
            Contracts.AssertValueOrNull(sinkTypeErrors);

            InnerError        = innerError;
            ErrorKind         = kind;
            Entity            = string.Empty;
            PropertyName      = string.Empty;
            Parent            = string.Empty;
            Severity          = severity;
            InternalException = internalException;
            TextSpan          = textSpan;
            SinkTypeErrors    = sinkTypeErrors;
            MessageKey        = errKey.Key;
            MessageArgs       = args;

            // We expect errKey to be the key for an error resource object within string resources.
            // We fall back to using a basic content string within string resources, for errors
            // that haven't yet been converted to an ErrorResource in the Resources.pares file.
            ErrorResource errorResource;
            string        shortMessage;
            string        longMessage;

            if (!StringResources.TryGetErrorResource(errKey, out errorResource))
            {
                errorResource = null;
                shortMessage  = StringResources.Get(errKey.Key);
                longMessage   = null;
            }
            else
            {
                shortMessage = errorResource.GetSingleValue(ErrorResource.ShortMessageTag);
                Contracts.AssertValue(shortMessage);
                longMessage = errorResource.GetSingleValue(ErrorResource.LongMessageTag);
            }


            ShortMessage     = FormatMessage(shortMessage, args);
            LongMessage      = FormatMessage(longMessage, args);
            HowToFixMessages = errorResource?.GetValues(ErrorResource.HowToFixTag) ?? GetHowToFix(errKey.Key);
            WhyToFixMessage  = errorResource?.GetSingleValue(ErrorResource.WhyToFixTag) ?? string.Empty;
            Links            = errorResource?.HelpLinks;
        }
Exemplo n.º 12
0
 internal BaseError(IDocumentError innerError, Exception internalException, DocumentErrorKind kind, DocumentErrorSeverity severity, ErrorResourceKey errKey, params object[] args)
     : this(innerError, internalException, kind, severity, errKey, textSpan : null, sinkTypeErrors : null, args : args)
 {
 }
Exemplo n.º 13
0
 public TexlError EnsureError(TexlNode node, ErrorResourceKey errKey, params object[] args)
 {
     return(EnsureError(DefaultSeverity, node, errKey, args));
 }