HandleError() public method

public HandleError ( Exception ex ) : string
ex System.Exception
return string
コード例 #1
0
 /// <summary>
 /// Renders all the objects in the list
 /// </summary>
 /// <param name="list"></param>
 /// <param name="context"></param>
 /// <param name="result"></param>
 protected void RenderAll(List <object> list, Context context, TextWriter result)
 {
     foreach (var token in list)
     {
         try
         {
             if (token is IRenderable renderableToken)
             {
                 renderableToken.Render(context, result);
             }
             else
             {
                 result.Write(token.ToString());
             }
         }
         catch (Exception ex)
         {
             if (ex.InnerException is LiquidException)
             {
                 ex = ex.InnerException;
             }
             result.Write(context.HandleError(ex));
         }
     }
 }
コード例 #2
0
ファイル: Block.cs プロジェクト: mwadams/dotliquid
        /// <summary>
        /// Renders all the objects in the list
        /// </summary>
        /// <param name="list"></param>
        /// <param name="context"></param>
        /// <param name="result"></param>
        protected async Task RenderAllAsync(List <object> list, Context context, TextWriter result)
        {
            foreach (var token in list)
            {
                context.CheckTimeout();

                try
                {
                    if (token is IRenderable renderableToken)
                    {
                        await renderableToken.RenderAsync(context, result).ConfigureAwait(false);
                    }
                    else
                    {
                        await result.WriteAsync(token.ToString()).ConfigureAwait(false);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.InnerException is LiquidException)
                    {
                        ex = ex.InnerException;
                    }
                    await result.WriteAsync(context.HandleError(ex)).ConfigureAwait(false);
                }
            }
        }
コード例 #3
0
ファイル: Block.cs プロジェクト: ostapkoenig/dotliquid
 protected void RenderAll(List <object> list, Context context, TextWriter result)
 {
     list.ForEach(token =>
     {
         try
         {
             if (token is IRenderable)
             {
                 ((IRenderable)token).Render(context, result);
             }
             else
             {
                 result.Write(token.ToString());
             }
         }
         catch (Exception ex)
         {
             if (ex.InnerException is LiquidException)
             {
                 ex = ex.InnerException;
             }
             result.Write(context.HandleError(ex));
         }
     });
 }
コード例 #4
0
ファイル: Block.cs プロジェクト: strogo/dotliquid
 protected void RenderAll(List<object> list, Context context, StringBuilder result)
 {
     list.ForEach(token =>
     {
         try
         {
             if (token is IRenderable)
                 ((IRenderable)token).Render(context, result);
             else
                 result.Append(token.ToString());
         }
         catch (Exception ex)
         {
             if (ex.InnerException is LiquidException)
                 ex = ex.InnerException;
             result.Append(context.HandleError(ex));
         }
     });
 }
コード例 #5
0
ファイル: Block.cs プロジェクト: Elph/dotliquid
 protected void RenderAll(List<object> list, Context context, TextWriter result)
 {
     foreach (var token in list)
     {
         try
         {
             if (token is IRenderable)
                 ((IRenderable)token).Render(context, result);
             else
                 result.Write(token.ToString());
         }
         catch (Exception ex)
         {
             if (ex.InnerException is LiquidException)
                 ex = ex.InnerException;
             result.Write(context.HandleError(ex));
         }
     }
 }