示例#1
0
 internal RenderingException(int charIndex, int row, int column,
                             RenderingError error, Exception innerException = null)
     : base(FormatMessage(charIndex, row, column, error), innerException)
 {
     CharIndex = charIndex;
     Row       = row;
     Column    = column;
     Error     = error;
 }
        private static void CheckError(
            string template, object globals,
            int row, int column, RenderingError error)
        {
            var t  = Template.FromString(template);
            var ex = Assert.Throws <RenderingException>(() => t.Render(globals));

            Assert.Equal(row, ex.Row);
            Assert.Equal(column, ex.Column);
            Assert.Equal(error, ex.Error);
        }
示例#3
0
 private static string FormatMessage(int charIndex, int row, int column, RenderingError error)
 => $"[{row},{column}](@{charIndex}): {error}";
示例#4
0
 private RenderingException ThrowHelper(SyntaxNode n, RenderingError e,
                                        Exception innerException = null)
 {
     (var r, var c) = GetCharPosition(_template, n.Start);
     return(new RenderingException(n.Start, r, c, e, innerException));
 }