WikiFunctions.ErrorHandler.BugReport.BugReport C# (CSharp) Method

BugReport() public method

public BugReport ( Exception ex ) : System
ex System.Exception
return System
            public BugReport(Exception ex)
            {
                var apiException = ex as ApiException;
                var thread = apiException != null ? apiException.ThrowingThread : System.Threading.Thread.CurrentThread;
                if (thread.Name != "Main thread")
                {
                    Thread = thread.Name;
                }

                StringBuilder stackTrace = new StringBuilder();
                FormatException(ex, stackTrace, ExceptionKind.TopLevel);
                StackTrace = stackTrace.ToString();

                if (apiException != null)
                {
                    ApiExtra = apiException.GetExtraSpecificInformation();
                }

                if (AppendToErrorHandler != null)
                {
                    StringBuilder append = new StringBuilder();
                    foreach (Delegate d in AppendToErrorHandler.GetInvocationList())
                    {
                        string retval = d.DynamicInvoke().ToString();
                        if (!string.IsNullOrEmpty(retval))
                            append.AppendLine(retval);
                    }
                    AppendedInfo = append.ToString();
                }

                AssemblyName hostingApp = Assembly.GetExecutingAssembly().GetName();
                Version = string.Format("{0} ({1}), {2} ({3})", Application.ProductName, Application.ProductVersion,
                    hostingApp.Name, hostingApp.Version);

                DotNetVersion = Environment.Version.ToString();

                // suppress unhandled exception if Variables constructor says 'ouch'
                try
                {
                    Version += ", revision " + Variables.Revision;
                }
                catch
                {
                }

                // TODO: Phab urls
                if (!string.IsNullOrEmpty(CurrentPage))
                {
                    // don't use Tools.WikiEncode here, to keep code portable to updater
                    // as it's not a pretty URL, we don't need to follow the MediaWiki encoding rules
                    string link = "[" + Variables.URLIndex + "?title=" + HttpUtility.UrlEncode(CurrentPage) + "&oldid=" +
                                  CurrentRevision + "]";

                    Duplicate = "[encountered while processing page ''" + link + "'']";
                }
                else if (!string.IsNullOrEmpty(ListMakerText))
                {
                    Duplicate = "'''ListMaker Text:''' " + ListMakerText;
                }
            }