JinianNet.JNTemplate.TemplateContext.AddError C# (CSharp) Method

AddError() public method

将异常添加到当前 异常集合中。
public AddError ( System e ) : void
e System 异常
return void
        public void AddError(System.Exception e)
        {
            if (this.ThrowExceptions)
            {
                throw e;
            }
            this._errors.Add(e);
        }

Usage Example

Exemplo n.º 1
0
 /// <inheritdoc />
 public virtual void Render(TextWriter writer, TemplateContext context)
 {
     if (templateResult == null)
     {
         if (this.Context.Mode == EngineMode.Interpreted)
         {
             templateResult = context.InterpretTemplate(this.TemplateKey, this.reader);
         }
         else
         {
             templateResult = context.CompileTemplate(this.TemplateKey, this.reader);
         }
         if (templateResult == null)
         {
             throw new TemplateException($"template error.");
         }
     }
     try
     {
         templateResult.Render(writer, context);
     }
     catch (System.Exception e)
     {
         context.AddError(e);
     }
 }
All Usage Examples Of JinianNet.JNTemplate.TemplateContext::AddError