• 00
  • :
  • 00
  • :
  • 00

异常信息 Exception

  void GetExceptionMsg(Exception ex, StringBuilder sb, string Prefix = "")
        {
            sb.AppendLine(Prefix + "【异常类型】:" + ex.GetType().Name);
            sb.AppendLine(Prefix + "【异常信息】:" + ex.Message);
            sb.AppendLine(Prefix + "【堆栈调用】:" + ex.StackTrace);
            sb.AppendLine(Prefix + "【异常方法】:" + ex.TargetSite);

            if (ex.InnerException != null)
                GetExceptionMsg(ex.InnerException, sb, Prefix + "\t");
        }

 

posted @ 2019-04-18 18:10  Garson_Zhang  阅读(276)  评论(0编辑  收藏  举报