Пример #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));
            }
        }