public async Task RetrieveExceptionReportListAsyncTest()
        {
            var exceptionReportSearchParameters = new ExceptionReportSearchParameters
            {
                DepartmentIds = "1",
                ClearanceStatus = "1",
                AgeFrom = "21",
                FirstName = "trott",
                LastName = "ryan",
                AgeTo = "42",
                ExceptionTypeIds = "23",
                PersonTypeId = "23",
                Gender = "M",
                VoyageId = "3",
                MaxResults = 50,
                OrderBy = "DepartmentIds",
                PageNumber = 2,
                Parts = "$all",
            };

            var exceptionReport = new ExceptionReport { Age = "48", Birthdate = System.DateTime.Now, BookingNo = "2", PersonId = "DK4 MID Port", Contact = "3456789098", Nationality = "Crew", FirstName = "Ryan", Gender = "M", LastName = "Trott", MiddleName = "henry", Stateroom = "1" };

            exceptionReport.IdentificationManifests.Add(new IdentificationManifest { CrewmemberId = "1", DocumentType = "2", GuestId = "2", Number = "22", PersonId = "1", PersonTypeId = "1", VisitorId = "1" });

            this.exceptionReport.Items.Add(exceptionReport);

            this.exceptionReportRepository.Setup(mockItem => mockItem.ListAsync(It.IsNotNull<ExceptionReportSearchParameters>())).Returns(Task.FromResult(this.exceptionReport));
            var alert = await this.exceptionReportData.ListAsync(exceptionReportSearchParameters);
            var searchQueryString = exceptionReportSearchParameters.ToQueryString();
            Assert.IsNotNull(alert);
            Assert.IsTrue(searchQueryString.Contains("DepartmentIds"));
            Assert.IsNotNull(alert);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        /// <returns>Crash report as string</returns>
        public void Write(Exception e)
        {
            ExceptionReportInfo info = new ExceptionReportInfo {
                MainException = e
            };
            ExceptionReportGenerator reportGenerator = new ExceptionReportGenerator(info);
            ExceptionReport          report          = reportGenerator.CreateExceptionReport();

            string crashDir = Path.Combine(Preferences.instance().getProperty("application.support.path"),
                                           "CrashReporter");

            Directory.CreateDirectory(crashDir);
            using (StreamWriter outfile = new StreamWriter(Path.Combine(crashDir, DateTime.Now.Ticks + ".txt")))
            {
                outfile.Write(report.ToString());
            }
            TaskDialog   prompt = new TaskDialog();
            DialogResult result = prompt.ShowCommandBox(Locale.localizedString("Do you want to report the last crash?", "Crash"),
                                                        Locale.localizedString("Do you want to report the last crash?", "Crash"),
                                                        Locale.localizedString(
                                                            "The application %@ has recently crashed. To help improve it, you can send the crash log to the author.", "Crash").Replace("%@", Preferences.instance().getProperty("application.name")),
                                                        String.Format("{0}|{1}",
                                                                      Locale.localizedString("Send", "Crash"),
                                                                      Locale.localizedString("Don't Send", "Crash")),
                                                        false, SysIcons.Error);

            if (DialogResult.OK == result)
            {
                if (0 == prompt.CommandButtonResult)
                {
                    Post(report.ToString());
                }
            }
        }
Esempio n. 3
0
        private void SetEnviromentInfo(ExceptionReport report)
        {
            report.cul = Thread.CurrentThread.CurrentCulture.Name;

            try
            {
                report.os = Environment.OSVersion.VersionString;
            }
            catch (Exception)
            {
                if (Configuration.ThrowExceptions)
                {
                    throw;
                }
            }

            if (Configuration.IncludeMachineName)
            {
                try
                {
                    report.hn = Environment.MachineName;
                }
                catch (Exception)
                {
                    if (Configuration.ThrowExceptions)
                    {
                        throw;
                    }
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Create ExecuteResponse for failed wps job
        /// </summary>
        /// <param name="wpsjob"></param>
        /// <returns></returns>
        public static ExecuteResponse CreateExecuteResponseForFailedWpsjob(WpsJob wpsjob)
        {
            ExecuteResponse response = new ExecuteResponse();

            response.statusLocation = wpsjob.StatusLocation;

            var uri = new Uri(wpsjob.StatusLocation);

            response.serviceInstance = string.Format("{0}://{1}/", uri.Scheme, uri.Host);
            response.service         = "WPS";
            response.version         = "1.0.0";

            var exceptionReport = new ExceptionReport {
                Exception = new List <ExceptionType> {
                    new ExceptionType {
                        ExceptionText = new List <string> {
                            wpsjob.Logs
                        }
                    }
                }
            };

            response.Status = new StatusType {
                ItemElementName = ItemChoiceType.ProcessFailed,
                Item            = new ProcessFailedType {
                    ExceptionReport = exceptionReport
                },
                creationTime = wpsjob.CreatedTime
            };
            return(response);
        }
Esempio n. 5
0
        /// <summary>
        /// Add or update an ExceptionReport to the database, and open an issue on GitHub if possible
        /// </summary>
        /// <param name="report"></param>
        /// <returns></returns>
        public static ExceptionReport AddOrUpdateExceptionReport(ExceptionReport report)
        {
            report = DatabaseEngine.AddOrUpdateExceptionReport(report);

            if (!report.Reported && report.Count >= 5 && !string.IsNullOrEmpty(GlobalConfig.GithubToken))
            {
                try
                {
                    var githubTokenAuth = new Credentials(GlobalConfig.GithubToken);
                    var client          = new GitHubClient(new ProductHeaderValue("GenericBot"));
                    client.Credentials = githubTokenAuth;
                    var issueToCreate = new NewIssue($"AUTOMATED: {report.Message}");
                    issueToCreate.Body = $"Stacktrace:\n" +
                                         $"{report.StackTrace}\n" +
                                         $"\n" +
                                         $"Reporting Build (if available): {GenericBot.BuildId}\n";

                    var issue = client.Issue.Create(client.User.Current().Result.Login, "GenericBot", issueToCreate).Result;
                    report.Reported = true;
                    report          = DatabaseEngine.AddOrUpdateExceptionReport(report);
                }
                catch (Exception ex)
                {
                    Logger.LogGenericMessage("An error occured reporting to github. Please check your credentials and that there is a repo \"GenericBot\" associated with your account.");
                    Logger.LogGenericMessage(ex.Message + "\n" + ex.StackTrace);
                }
            }

            return(report);
        }
Esempio n. 6
0
 public bool Equals(ExceptionReport other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.Message, Message) && Equals(other.ExceptionText, ExceptionText) &&
            Equals(other.CorrelationId, CorrelationId);
 }
Esempio n. 7
0
        private void GetReportsClick(object sender, EventArgs e)
        {
            //Array is indexed by tags in listview, so empying listview first stops out of bounds access in the case of an exception
            m_ListView3.Items.Clear();
            m_AllReports = m_Database.ExceptionReports.GetAllReports();

            for (int i = 0; i < m_AllReports.GetLength(0) && i < c_Limit; i++)
            {
                ExceptionReport thisReport = m_AllReports[i];
                //Get info, skip if no info found
                var reportInformation = new ExceptionReportInformation();
                if (!thisReport.TryGetReportInformation(ref reportInformation))
                {
                    continue;
                }

                string projectName = m_Database.Projects.GetProjectInformation(reportInformation.ProjectID).Name;
                var    item        =
                    new ListViewItem(new[]
                {
                    projectName, reportInformation.CreationDate.ToString("g"),
                    reportInformation.ExceptionType, reportInformation.ExceptionMessage,
                    reportInformation.TypeName, reportInformation.MethodName,
                    reportInformation.Unread.ToString(), reportInformation.Fixed.ToString(),
                    reportInformation.Flag.ToString(), reportInformation.UserID
                })
                {
                    Tag = i
                };

                m_ListView3.Items.Add(item);
            }
        }
        /// <summary>
        /// copy the report to the clipboard, using the clipboard implementation supplied
        /// </summary>
        public void CopyReportToClipboard()
        {
            ExceptionReport exceptionReport = CreateExceptionReport();

            _clipboard.CopyTo(exceptionReport.ToString());
            _view.ProgressMessage = string.Format("{0} copied to clipboard", ReportInfo.TitleText);
        }
Esempio n. 9
0
        private IActionResult ResponseWithExceptionReport(string exceptionCode, string message, string locator)
        {
            var xmlDoc = new ExceptionReport(exceptionCode, message, locator).ToXml();

            Response.ContentType = MediaTypeNames.Application.Xml;
            Response.StatusCode  = (int)HttpStatusCode.OK;
            return(File(xmlDoc.ToUTF8ByteArray(), Response.ContentType));
        }
Esempio n. 10
0
        public HtmlTag VisualizeException(ExceptionReport report)
        {
            var tag = new HtmlTag("div");

            tag.Add("p").Add("b").Text("Exception: " + report.ExceptionType);
            tag.Add("pre").AddClass("text-warning").Text(report.ExceptionText);

            return(tag);
        }
Esempio n. 11
0
        private IActionResult ResponseWithNotFoundError(string exceptionCode, string message)
        {
            var xmlDoc = new ExceptionReport(exceptionCode, message).ToXml();

            Response.ContentType = MediaTypeNames.Text.Xml + "; charset=utf-8"; // TODO: better way?
            Response.StatusCode  = (int)HttpStatusCode.NotFound;
            // TODO: content-disposition: filename="message.xml"
            return(File(xmlDoc.ToUTF8ByteArray(), Response.ContentType));
        }
Esempio n. 12
0
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var text = ExceptionReport.GetText(e.ExceptionObject as Exception);

            Trace.TraceError(text);
#if !DEBUG
            Environment.Exit(1);
#endif
        }
        public void build_by_exception()
        {
            var exception = new NotImplementedException("What?");

            var report = new ExceptionReport(exception);

            report.Message.ShouldEqual(exception.Message);
            report.ExceptionText.ShouldEqual(exception.ToString());
            report.ExceptionType = "NotImplementedException";
        }
        public void build_by_exception_and_message()
        {
            var exception = new NotImplementedException("What?");

            var report = new ExceptionReport("Something went wrong!", exception);

            report.Message.ShouldEqual("Something went wrong!");
            report.ExceptionText.ShouldEqual(exception.ToString());
            report.ExceptionType = "NotImplementedException";
        }
        /// <summary>
        /// Handles the custom action specified in URL query path.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <param name="queryParameters">The query parameters.</param>
        /// <returns></returns>
        private static OperationResult HandleCustomAction(OperationResult result, NameValueCollection queryParameters)
        {
            if (queryParameters.AllKeys.Contains("$$validate"))
            {
                ExceptionReport report = new ExceptionReport();

                throw new NotImplementedException();
            }
            return(result);
        }
Esempio n. 16
0
 public void AddError(HubCallerContext context, ExceptionReport exceptionReport)
 {
     if (!IsValidSession(context, out HubClientSession session))
     {
         return;
     }
     session.Errors.Add(exceptionReport);
     //_clients.NotifyClientInteracted(session);
     _clients.AddOrUpdate(session);
 }
Esempio n. 17
0
        private static void ShowExceptionReport(Exception exception)
        {
            var viewModel = new ExceptionViewModel(exception);
            var window    = new ExceptionReport();

            viewModel.OnWindowClosed += (vm, args) => window.Close();
            window.DataContext        = viewModel;
            window.Show();
            window.Focus();
        }
Esempio n. 18
0
        public Task LogErrorMessage(Exception exception, ParsedCommand context)
        {
            Console.ForegroundColor = ConsoleColor.DarkMagenta;
            string message = $"[Error] {DateTime.UtcNow.ToString(@"yyyy-MM-dd_HH-mm")}: {exception}";

            Console.WriteLine(message);
            File.AppendAllText($"files/sessions/{SessionId.Substring(0, 8)}.log", message + "\n");

            if (!string.IsNullOrEmpty(Core.GlobalConfig.CriticalLoggingWebhookUrl))
            {
                var webhook = new Discord.Webhook.DiscordWebhookClient(Core.GlobalConfig.CriticalLoggingWebhookUrl);

                ExceptionReport report = Core.AddOrUpdateExceptionReport(new ExceptionReport(exception));

                var builder = new EmbedBuilder()
                              .WithColor(255, 0, 0)
                              .WithCurrentTimestamp()
                              .AddField(new EmbedFieldBuilder()
                                        .WithName("Error Message")
                                        .WithValue(exception.GetType() + ": " + exception.Message));
                if (!string.IsNullOrEmpty(exception.StackTrace))
                {
                    builder.AddField(new EmbedFieldBuilder()
                                     .WithName("Stack Trace")
                                     .WithValue(exception.StackTrace.Length > 1000 ? exception.StackTrace.Substring(exception.StackTrace.Length - 1000, 1000) : exception.StackTrace));
                }

                if (context != null)
                {
                    builder.AddField(new EmbedFieldBuilder()
                                     .WithName($"Location")
                                     .WithValue($"{context.Guild.Name} ({context.Guild.Id}) - #{context.Channel.Name} ({context.Channel.Id})"));
                    builder.AddField(new EmbedFieldBuilder()
                                     .WithName($"Author")
                                     .WithValue($"{context.Author.Username}#{context.Author.Discriminator} ({context.Author.Id})"));
                    builder.AddField(new EmbedFieldBuilder()
                                     .WithName($"Message")
                                     .WithValue(context.Message.Content));
                }

                builder.AddField(new EmbedFieldBuilder()
                                 .WithName("Count")
                                 .WithValue(report.Count).WithIsInline(true))
                .AddField(new EmbedFieldBuilder()
                          .WithName("Reported")
                          .WithValue(report.Reported)
                          .WithIsInline(true));

                webhook.SendMessageAsync("", embeds: new List <Embed> {
                    builder.Build()
                });
            }

            return(Task.FromResult(1));
        }
Esempio n. 19
0
        //public static ParameterForm GetParameterForm(this Parameter param, Document doc)
        //{
        //    ParameterForm pf = ParameterForm.None;

        //    Debug.WriteLine("This parameter's type is: " + param.Definition.ParameterType.ToString());
        //    if (!param.Definition.ParameterType.ToString().Equals("Invalid"))
        //    {
        //        try
        //        {
        //            DefinitionBindingMap dbm = doc.ParameterBindings;
        //            Debug.WriteLine("The DefinitionBindingMap has " + dbm.Size.ToString() + "entries");

        //            Definition d = param.Definition;
        //            Binding b = dbm.get_Item(d);

        //            Debug.Assert(b is InstanceBinding, (d.Name + " is an instance"));
        //            Debug.Assert(b is TypeBinding, (d.Name + " is a type"));
        //        }

        //        catch (Autodesk.Revit.Exceptions.InvalidObjectException invOe)
        //        {
        //            // coode
        //            Debug.WriteLine("The object was invalid?" + "\n" + invOe.Message);
        //        }

        //        catch (Autodesk.Revit.Exceptions.InvalidOperationException auto_ioe)
        //        {
        //            // code
        //            Debug.WriteLine("The operation was invalid?" + "\n" + auto_ioe.Message);
        //        }
        //    }

        //    return pf;
        //}

        public static string GetParameterValue(this Parameter param)
        {
            try
            {
                switch (param.StorageType)
                {
                default:
                    // A NULL VALUE MEANS THE PARAMETER IS UNEXPOSED
                    return("PARAMETER HAS NOT BEEN EXPOSED");

                case StorageType.Double:
                    return(GetParameterDouble(param));

                case StorageType.Integer:
                    if (ParameterType.YesNo != param.Definition.ParameterType)
                    {
                        return("INTEGER: " + param.AsInteger().ToString());
                    }

                    if (param.AsInteger() == 0)
                    {
                        return("False");
                    }

                    return("True");

                case StorageType.String:
                    return(param.AsString());

                case StorageType.ElementId:
                    // this one is tricky
                    // a positive ElementID can point to a specific element
                    // however a negative one can mean a number of different things

                    if (param.AsElementId().IntegerValue <= 0)
                    {
                        return("ELEMENTID: " + param.AsElementId().IntegerValue.ToString());
                    }

                    using (Document paramdoc = param.Element.Document)
                    {
                        return(paramdoc.GetElement(param.AsElementId()).Name);
                    }
                }
            }


            catch (InvalidObjectException invalidoex)
            {
                ExceptionReport.DebugLog(invalidoex);
            }

            return(null);
        }
        public void ExceptionReport_CanBeCreated()
        {
            //Given
            ExceptionReport exceptionReport;

            //When
            exceptionReport = new ExceptionReport();

            //Then
            Assert.NotNull(exceptionReport);
        }
Esempio n. 21
0
        private string BuildEmailText()
        {
            string        emailIntroString = emailTextBuilder.CreateIntro(ReportInfo.TakeScreenshot);
            StringBuilder entireEmailText  = new StringBuilder(emailIntroString);

            ExceptionReport report = reportGenerator.CreateExceptionReport();

            entireEmailText.Append(report);

            return(entireEmailText.ToString());
        }
Esempio n. 22
0
        public async void SendException(string context, Exception ex)
        {
            if (!IsValidConnState())
            {
                return;
            }
            var method = nameof(IMessageBroadcastHub.ReceiveException);
            var report = new ExceptionReport(context, ex);
            await _hub.Invoke(method, report);

            await Loggly.Post(ex, context);
        }
Esempio n. 23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         ExceptionReport ex = (ExceptionReport)Session["exception"];
         txtException.Text = new JavaScriptSerializer().Serialize(ex);
     }
     catch (Exception)
     {
         // throw;  // Let's not.  Could cause a cycle of hell.
     }
 }
Esempio n. 24
0
        public static ExceptionReport GetExceptionReport(string exceptionCode = null, string locator = null, params string[] exceptionText)
        {
            ExceptionType   exceptionType = GetExceptionType(exceptionCode, locator, exceptionText);
            ExceptionReport exception     = new ExceptionReport()
            {
                Exception = new ExceptionType[]
                {
                    exceptionType
                }
            };

            return(exception);
        }
Esempio n. 25
0
        public ExceptionReportModal Save(ExceptionReportModal model)
        {
            model.TransMessage        = new TransactionMessage();
            model.TransMessage.Status = MessageStatus.Error;
            try
            {
                #region check duplicate
                //if (UnitofWork.RepoExceptionReport.Where(x => x.ExceptionID == model.ExceptionID).Count() > 0)
                //{
                //    model.TransMessage.Message = utilityHelper.ReadGlobalMessage("ExceptionReport", "Duplicate");
                //    return model;
                //}
                #endregion

                ExceptionReport dbExceptionReport = UnitofWork.RepoExceptionReport.Where(x => x.ExceptionID == model.ExceptionID).FirstOrDefault();

                bool isSave = false;

                if (dbExceptionReport == null)
                {
                    #region Save
                    dbExceptionReport = new ExceptionReport();
                    UnitofWork.RepoExceptionReport.Add(dbExceptionReport);
                    model.TransMessage.Message = utilityHelper.ReadGlobalMessage("ExceptionReport", "Save");
                    isSave = true;
                    #endregion
                }
                else
                {
                    #region Update
                    model.TransMessage.Message = utilityHelper.ReadGlobalMessage("ExceptionReport", "Update");
                    #endregion
                }
                #region Set Value
                dbExceptionReport.StoreId     = model.StoreId;
                dbExceptionReport.MonthId     = model.MonthId;
                dbExceptionReport.Description = model.Description;
                dbExceptionReport.CreatedOn   = model.CreatedOn;
                #endregion

                UnitofWork.Commit();
                model.ExceptionID         = dbExceptionReport.ExceptionID;
                model.TransMessage.Status = MessageStatus.Success;
            }
            catch (Exception ex)
            {
                EventLogHandler.WriteLog(ex);
            }

            return(model);
        }
Esempio n. 26
0
        public async Task CreateSession_FailedJobGiven_ShouldRaiseFailedEvent()
        {
            ExceptionReport exceptionReport = null;
            var             session         = new Session <string>(new MockWpsClient(new StatusInfo
            {
                Status = JobStatus.Failed
            }), string.Empty, JobId);

            session.Failed += (sender, args) => { exceptionReport = args.ExceptionReport; };

            await session.StartPolling();

            exceptionReport.Should().NotBeNull();
        }
Esempio n. 27
0
        /// <summary>
        /// Submit an exception to exceptron Servers.
        /// </summary>
        /// <param name="exceptionData">Exception data to be reported to the server</param>
        public ExceptionResponse SubmitException(ExceptionData exceptionData)
        {
            try
            {
                ValidateState(exceptionData);

                var report = new ExceptionReport();

                report.ap   = Configuration.ApiKey;
                report.dn   = ClientName;
                report.dv   = ClientVersion;
                report.aver = _applicationVersion;

                report.ext = exceptionData.Exception.GetType().FullName;
                report.stk = ConvertToFrames(exceptionData.Exception);
                report.exm = exceptionData.Exception.Message;

                report.cmp = exceptionData.Component;
                report.uid = exceptionData.UserId;
                report.msg = exceptionData.Message;
                report.sv  = (int)exceptionData.Severity;
                report.fv  = _maxFrameworkVersion;
                report.ft  = FrameworkType;

                SetHttpInfo(exceptionData, report);
                SetEnviromentInfo(report);

                var exceptionResponse = RestClient.Put <ExceptionResponse>(Configuration.Host, report);

                exceptionData.Exception.Data["et"] = exceptionResponse.RefId;

                return(exceptionResponse);
            }
            catch (Exception e)
            {
                Trace.WriteLine("Unable to submit exception to exceptron. ", e.ToString());

                if (Configuration.ThrowExceptions)
                {
                    throw;
                }

                return(new ExceptionResponse {
                    Exception = e
                });
            }
        }
Esempio n. 28
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["exception"] != null)
     {
         try
         {
             ExceptionReport ex = (ExceptionReport)Session["exception"];
             lblDetails.Text = ex.InnerExceptionMessage;
             if (ex.IssueURL != string.Empty)
             {
                 lblDetails.Text = string.Format("<p style='font-weight: bold; font-size: 1.5em'>An issue has been automatically opened. Please help us to fix this by adding a comment to the ticket and telling us what you were trying to do. Your issue can be found at <a target='_blank' href='{0}'>{0}</a>.</p>", ex.IssueURL);
             }
         }
         catch
         {
         }
     }
 }
Esempio n. 29
0
        ///<inheritdoc cref="IDatabaseEngine.AddOrUpdateExceptionReport(ExceptionReport)"/>
        public ExceptionReport AddOrUpdateExceptionReport(ExceptionReport report)
        {
            var             _exceptionDb = liteDatabase.GetCollection <ExceptionReport>($"exceptions");
            ExceptionReport foundReport;

            if (_exceptionDb.FindAll().ToList()
                .HasElement(r => r.Message.Equals(report.Message) && r.StackTrace.Equals(report.StackTrace), out foundReport))
            {
                foundReport.Count++;
                _exceptionDb.Upsert(foundReport);
            }
            else
            {
                _exceptionDb.Insert(report);
                foundReport = report;
            }
            return(foundReport);
        }
Esempio n. 30
0
        ///<inheritdoc cref="IDatabaseEngine.AddOrUpdateExceptionReport(ExceptionReport)"/>
        public ExceptionReport AddOrUpdateExceptionReport(ExceptionReport report)
        {
            var             _db         = mongoClient.GetDatabase("global");
            var             _collection = _db.GetCollection <ExceptionReport>("exceptionReports");
            ExceptionReport foundReport;

            if (_collection.Find(new BsonDocument()).ToList()
                .HasElement(r => r.Message.Equals(report.Message) && r.StackTrace.Equals(report.StackTrace), out foundReport))
            {
                foundReport.Count++;
                _collection.FindOneAndReplace(r => r.Message.Equals(foundReport.Message) && r.StackTrace.Equals(foundReport.StackTrace), foundReport);
            }
            else
            {
                _collection.InsertOne(report);
                foundReport = report;
            }

            return(foundReport);
        }
Esempio n. 31
0
        private static ExecuteResponse GetWpsExecuteResponse(HttpWebRequest httpWebRequest, ILogger logger)
        {
            try
            {
                using (HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse())
                {
                    using (Stream stream = httpWebResponse.GetResponseStream())
                    {
                        var sr       = new StreamReader(stream);
                        var content  = sr.ReadToEnd();
                        var strr     = new StringReader(content);
                        var response = (ExecuteResponse)executeResponseSerializer.Deserialize(strr);
                        if (httpWebResponse.StatusCode != HttpStatusCode.OK)
                        {
                            logger.LogDebug("WPS Execute Response returned an error at {0} : {1}", httpWebRequest.RequestUri, content);
                            try
                            {
                                ExceptionReport exceptionReport = (ExceptionReport)exceptionResponseSerializer.Deserialize(strr);
                                throw new InvalidOperationException(string.Format("WPS Execute Response at {0} returned an exception report. {1}", httpWebRequest.RequestUri, exceptionReport.Exceptions.First().ExceptionText));
                            }
                            catch (Exception e2)
                            {
                                throw e2;
                            }
                        }
                        if (response != null)
                        {
                            return(response);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                logger.LogError("Error reading the execute response at {1} : {0}", e.Message, httpWebRequest.RequestUri);
                logger.LogDebug(e.StackTrace);
                throw;
            }

            return(null);
        }
 public ExceptionReportTag(ExceptionReport report)
     : base("div")
 {
     AddClass("exception-report");
     Add("pre").Text(report.ExceptionText);
 }
Esempio n. 33
0
 public void Exception(ExceptionReport report)
 {
     _holderTag.Add("pre").Text(report.Text);
 }
Esempio n. 34
-1
        public HtmlTag VisualizeException(ExceptionReport report)
        {
            var tag = new HtmlTag("div");
            tag.Add("p").Add("b").Text("Exception: " + report.ExceptionType);
            tag.Add("pre").AddClass("text-warning").Text(report.ExceptionText);

            return tag;
        }