public static string ReportException(int level, Exception e, bool bWithLineFlag = true, string prefix = " ") { string fullName = e.GetType().FullName; string key; switch (key = fullName) { } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("\r\n"); stringBuilder.Append(fullName + ": " + e.Message + "\r\n"); string text = prefix; StackTrace stackTrace = new StackTrace(true); for (int i = stackTrace.FrameCount - 1; i >= 0; i--) { StackFrame frame = stackTrace.GetFrame(i); if (CommonAPI.IsMethodToBeIncluded(frame)) { stringBuilder.Append(text); if (i != stackTrace.FrameCount - 1) { stringBuilder.Append("> "); } stringBuilder.AppendLine(CommonAPI.MethodCallLog(frame)); text += "-"; } } if (!bWithLineFlag) { stringBuilder.Replace("\r\n", ""); } return(stringBuilder.ToString()); }
public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Exception e2 = (Exception)e.ExceptionObject; CommonAPI.ReportException(0, e2, true, " "); }
public static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { Exception exception = e.Exception; CommonAPI.ReportException(0, exception, true, " "); }