Beispiel #1
0
        private static void DoPost(string description)
        {
            try
            {
                //create exception entity
                var report = new TFSExceptionReport
                             (
                    ApplicationName,
                    Reporter,
                    Reporter, TheException,
                    Version,
                    description);

                //log to file
                ReportLogger.LogToFile(report);

                //post to service.
                var result = (!DoNotSend) ? report.Post() : null;

                ReportLogger.LogInfo("Result posted");
                //if error show to user.
                if (result != null)
                {
                    ReportLogger.LogExceptionsDuringDelivery(
                        new FileLoadException(
                            "Failed to deliver exception to url = '" + ServiceSettings.ServiceUrl + "'", result));
                    try
                    {
                        //failed to deliver exception display for user.
                        _form.ShowDeliveryFailure(result.Message, result);
                    }
                    catch (System.Exception ex)
                    {
                        //failed to show delivery failure... just log
                        ReportLogger.LogExceptionsDuringDelivery(
                            new InvalidOperationException("Failed to show delivery exception", ex));
                    }
                }
            }
            catch (System.Exception ex)
            {
                ReportLogger.LogExceptionsDuringDelivery(
                    new FileLoadException("Exception during TFS exception report create or post", ex));
            }
        }
Beispiel #2
0
        /// <summary>
        /// report W/O GUI.
        /// </summary>
        /// <param name="currentNtUser"></param>
        /// <param name="version"></param>
        /// <param name="applicationName"></param>
        /// <param name="e"></param>
        internal static void ReportExceptionWithNoGUI(string currentNtUser, string version, string applicationName, System.Exception e)
        {
            try
            {
                //ignore result since we are not using any UI to provide user feedback.
                //any errors will be logged by the Post function.
                var report =
                    new TFSExceptionReport(
                        applicationName,
                        currentNtUser,
                        currentNtUser, e,
                        version,
                        "Exception reported w/o description");

                ReportLogger.LogToFile(report);

                report.Post();
            }
            catch (System.Exception ex)
            {
                ReportLogger.LogExceptionsDuringDelivery(new System.Exception("Failed to deliver exception (no GUI)", ex));
            }
        }