Exemplo n.º 1
0
 private void OnSubmittingExceptionlessEvent(object sender, EventSubmittingEventArgs e)
 {
     foreach (var form in Application.OpenForms.Cast <Form>())
     {
         form.TopMost = false;
     }
 }
Exemplo n.º 2
0
        private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            if (logTextBox.InvokeRequired)
            {
                logTextBox.Invoke(new EventHandler <EventSubmittingEventArgs>(OnSubmittingEvent), sender, e);
                return;
            }

            e.Event.Data["BaseDirectory"] = AppDomain.CurrentDomain.BaseDirectory;
            if (e.Event.Message == "Important Exception")
            {
                e.Event.Tags.Add("Important");
            }

            if (!String.IsNullOrEmpty(e.Event.ReferenceId))
            {
                logTextBox.AppendText(String.Format("Submitting Event: {0}{1}", e.Event.ReferenceId, Environment.NewLine));
            }
            else
            {
                logTextBox.AppendText("Submitting Event");
            }

            statusLabel.Text = "Submitting Message";
        }
Exemplo n.º 3
0
        private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e) {
            e.Event.Tags.Add("ExtraTag");

            var exception = e.PluginContextData.GetException();
            if (exception != null && exception.GetType() == typeof(InvalidOperationException))
                e.Cancel = true;
        }
Exemplo n.º 4
0
 /// <summary>
 /// 忽略404
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
 {
     // 忽略404错误
     if (e.Event.IsNotFound())
     {
         e.Cancel = true;
         return;
     }
 }
Exemplo n.º 5
0
 private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
 {
     if (!e.IsUnhandledError)
     {
         return;
     }
     e.Event.SetReferenceId(Guid.NewGuid().ToString("N"));
     e.Event.MarkAsCritical();
 }
        private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e) {
            e.Event.Data["BaseDirectory"] = AppDomain.CurrentDomain.BaseDirectory;
            if (e.Event.Message == "Important Exception")
                e.Event.Tags.Add("Important");

            if (!String.IsNullOrEmpty(e.Event.ReferenceId))
                WriteLog(String.Format("Submitting Event: {0}{1}", e.Event.ReferenceId, Environment.NewLine));
            else
                WriteLog("Submitting Event");
        }
Exemplo n.º 7
0
        private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            e.Event.Tags.Add("ExtraTag");

            var exception = e.PluginContextData.GetException();

            if (exception != null && exception.GetType() == typeof(InvalidOperationException))
            {
                e.Cancel = true;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 默认提交异常处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void Default_SubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            var argEvent = e.Event;

            if (argEvent.Type == Event.KnownTypes.Log && argEvent.Source == "Ocelot.Configuration.Repository.FileConfigurationPoller")
            {
                e.Cancel = true;
                return;
            }
            // 只处理未处理的异常
            if (!e.IsUnhandledError)
            {
                return;
            }


            //忽略没有错误体的错误
            var error = argEvent.GetError();

            if (error == null)
            {
                return;
            }

            // 忽略404错误
            if (e.Event.IsNotFound())
            {
                e.Cancel = true;
                return;
            }

            //忽略401(Unauthorized)和请求验证的错误.
            if (error.Code == "401")
            {
                e.Cancel = true;
                return;
            }

            //忽略任何未被代码抛出的异常
            var handledNamespaces = new List <string> {
                "Exceptionless"
            };
            var handledNamespaceList = error.StackTrace.Select(s => s.DeclaringNamespace).Distinct();

            if (!handledNamespaceList.Any(ns => handledNamespaces.Any(ns.Contains)))
            {
                e.Cancel = true;
                return;
            }

            e.Event.Tags.Add("未捕获异常"); //添加系统异常标签
            e.Event.MarkAsCritical();  //标记为关键异常
        }
Exemplo n.º 9
0
        /// <summary>
        /// 默认提交异常处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void Default_SubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            if (SubmittingEvent != null)
            {
                //如果客户端自定义提交异常,则走自定义,否则走默认的异常处理事件
                SubmittingEvent(sender, e);
            }
            else
            {
                // 只处理未处理的异常
                if (!e.IsUnhandledError)
                {
                    return;
                }

                //忽略没有错误体的错误
                var error = e.Event.GetError();
                if (error == null)
                {
                    return;
                }

                // 忽略404错误
                if (e.Event.IsNotFound())
                {
                    e.Cancel = true;
                    return;
                }

                //忽略401(Unauthorized)和请求验证的错误.
                if (error.Code == "401" || error.Type == "System.Web.HttpRequestValidationException")
                {
                    e.Cancel = true;
                    return;
                }

                //忽略任何未被代码抛出的异常
                var handledNamespaces = new List <string> {
                    "Exceptionless"
                };
                var handledNamespaceList = error.StackTrace.Select(s => s.DeclaringNamespace).Distinct();
                if (!handledNamespaceList.Any(ns => handledNamespaces.Any(ns.Contains)))
                {
                    e.Cancel = true;
                    return;
                }

                e.Event.Tags.Add("未捕获异常"); //添加系统异常标签
                e.Event.MarkAsCritical();  //标记为关键异常
            }
        }
Exemplo n.º 10
0
        private async void ExceptionlessSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            if (e.IsUnhandledError)
            {
                e.Cancel = true;

                await Application.Current.Dispatcher.Invoke(async() =>
                {
                    modelHelpers.CloseAllFlyouts();
                    await modelHelpers.OpenFlyout(new Error(modelHelpers, e.Event));
                    modelHelpers.CloseApp(true);
                });
            }
        }
Exemplo n.º 11
0
        private async void ExceptionlessSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            await Application.Current.Dispatcher.Invoke(async() =>
            {
                if (!e.IsUnhandledError)
                {
                    return;
                }

                e.Cancel = true;
                await OpenFlyout(new Error(ViewModel, e.Event));
                CloseApp(true);
            });
        }
Exemplo n.º 12
0
        private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            e.Event.Data["BaseDirectory"] = AppDomain.CurrentDomain.BaseDirectory;
            if (e.Event.Message == "Important Exception")
            {
                e.Event.Tags.Add("Important");
            }

            if (!String.IsNullOrEmpty(e.Event.ReferenceId))
            {
                WriteLog($"Submitting Event: {e.Event.ReferenceId}{Environment.NewLine}");
            }
            else
            {
                WriteLog("Submitting Event");
            }
        }
Exemplo n.º 13
0
        private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            // 仅处理未被处理过的异常
            if (!e.IsUnhandledError)
            {
                return;
            }

            // 忽略404事件
            if (e.Event.IsNotFound())
            {
                e.Cancel = true;
                return;
            }

            // 获取error对象
            var error = e.Event.GetError();

            if (error == null)
            {
                return;
            }

            // 忽略 401 或 `HttpRequestValidationException`异常
            if (error.Code == "401" || error.Type == "System.Web.HttpRequestValidationException")
            {
                e.Cancel = true;
                return;
            }

            // 忽略不是指定命名空间代码抛出的异常
            var handledNamespaces = new List <string> {
                "Exceptionless"
            };

            if (!error.StackTrace.Select(s => s.DeclaringNamespace).Distinct().Any(ns => handledNamespaces.Any(ns.Contains)))
            {
                e.Cancel = true;
                return;
            }

            e.Event.AddObject(order, "Order", excludedPropertyNames: new[] { "CreditCardNumber" }, maxDepth: 2);
            e.Event.Tags.Add("Order");
            e.Event.MarkAsCritical();
            e.Event.SetUserIdentity(user.EmailAddress);
        }
Exemplo n.º 14
0
        private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e) {
            if (logTextBox.InvokeRequired) {
                logTextBox.Invoke(new EventHandler<EventSubmittingEventArgs>(OnSubmittingEvent), sender, e);
                return;
            }

            e.Event.Data["BaseDirectory"] = AppDomain.CurrentDomain.BaseDirectory;
            if (e.Event.Message == "Important Exception")
                e.Event.Tags.Add("Important");

            if (!String.IsNullOrEmpty(e.Event.ReferenceId))
                logTextBox.AppendText($"Submitting Event: {e.Event.ReferenceId}{Environment.NewLine}");
            else
                logTextBox.AppendText("Submitting Event");

            statusLabel.Text = "Submitting Message";
        }
Exemplo n.º 15
0
        private void OnSubmittingEvent(object sender, EventSubmittingEventArgs args) {
            // TODO: Should we be doing this for only unhandled exceptions or all events?
            //if (args.Event.Exception.GetType() == typeof(OperationCanceledException) || args.Event.Exception.GetType() == typeof(TaskCanceledException)) {
            //    args.Cancel = true;
            //    return;
            //}

            // TODO: We should get these from the owin context.
            //var projectId = User.GetProjectId();
            //if (!String.IsNullOrEmpty(projectId)) {
            //    var projectRepository = DependencyResolver.Current.GetService<IProjectRepository>();
            //    args.Event.AddObject(projectRepository.GetById(projectId), "Project");
            //}

            //var user = User.GetClaimsPrincipal();
            //if (user != null)
            //    args.Event.AddObject(user, "User");
        }
Exemplo n.º 16
0
        /// <summary>
        /// 全局配置Exceptionless
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            // 只处理未处理的异常
            if (!e.IsUnhandledError)
            {
                return;
            }

            // 忽略404错误
            if (e.Event.IsNotFound())
            {
                e.Cancel = true;
                return;
            }

            // 忽略没有错误体的错误
            var error = e.Event.GetError();

            if (error == null)
            {
                return;
            }
            // 忽略 401 (Unauthorized) 和 请求验证的错误.
            if (error.Code == "401" || error.Type == "System.Web.HttpRequestValidationException")
            {
                e.Cancel = true;
                return;
            }
            // Ignore any exceptions that were not thrown by our code.
            var handledNamespaces = new List <string> {
                "Exceptionless"
            };

            if (!error.StackTrace.Select(s => s.DeclaringNamespace).Distinct().Any(ns => handledNamespaces.Any(ns.Contains)))
            {
                e.Cancel = true;
                return;
            }
            // 添加附加信息.
            //e.Event.AddObject(order, "Order", excludedPropertyNames: new[] { "CreditCardNumber" }, maxDepth: 2);
            e.Event.Tags.Add("MunicipalPublicCenter.BusinessApi");
            e.Event.MarkAsCritical();
            //e.Event.SetUserIdentity();
        }
Exemplo n.º 17
0
        private void OnSubmittingEvent(object sender, EventSubmittingEventArgs args)
        {
            // TODO: Should we be doing this for only unhandled exceptions or all events?
            //if (args.Event.Exception.GetType() == typeof(OperationCanceledException) || args.Event.Exception.GetType() == typeof(TaskCanceledException)) {
            //    args.Cancel = true;
            //    return;
            //}

            // TODO: We should get these from the owin context.
            //var projectId = User.GetProjectId();
            //if (!String.IsNullOrEmpty(projectId)) {
            //    var projectRepository = DependencyResolver.Current.GetService<IProjectRepository>();
            //    args.Event.AddObject(projectRepository.GetById(projectId), "Project");
            //}

            //var user = User.GetClaimsPrincipal();
            //if (user != null)
            //    args.Event.AddObject(user, "User");
        }
Exemplo n.º 18
0
        /// <summary>
        /// 过滤无关提交事件
        /// </summary>
        /// <param name="sender">引发对象</param>
        /// <param name="e">事件提交参数</param>
        private static void FilterUnrelatedSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            // 仅处理未被处理过的异常
            if (!e.IsUnhandledError)
            {
                return;
            }

            // 忽略404事件
            if (e.Event.IsNotFound())
            {
                e.Cancel = true;
                return;
            }

            // 获取error对象
            var error = e.Event.GetError();

            if (error == null)
            {
                return;
            }

            // 忽略 401 或 `HttpRequestValidationException`异常
            if (error.Code == "401" || error.Type == "System.Web.HttpRequestValidationException")
            {
                e.Cancel = true;
                return;
            }

            // 忽略不是指定命名空间代码抛出的异常
            var handledNamespaces = new List <string> {
                "Exceptionless"
            };

            if (!error.StackTrace.Select(s => s.DeclaringNamespace).Distinct().Any(ns => handledNamespaces.Any(ns.Contains)))
            {
                e.Cancel = true;
                return;
            }

            e.Event.MarkAsCritical();
        }
Exemplo n.º 19
0
        public void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            // 只处理未处理的异常
            //if (!e.IsUnhandledError)
            //{
            //    return;
            //}

            // 忽略404错误
            if (e.Event.IsNotFound())
            {
                e.Cancel = true;
                return;
            }

            // 忽略没有错误体的错误
            var error = e.Event.GetError();

            if (error == null)
            {
                return;
            }

            // 忽略 401 (Unauthorized) 和 请求验证的错误.
            if (error.Code == "401" || error.Type == "System.Web.HttpRequestValidationException")
            {
                e.Cancel = true;
                return;
            }

            // Ignore any exceptions that were not thrown by our code.
            //var handledNamespaces = new List<string> { "Exceptionless" };
            //if (!error.StackTrace.Select(s => s.DeclaringNamespace).Distinct().Any(ns => handledNamespaces.Any(ns.Contains)))
            //{
            //    e.Cancel = true;
            //    return;
            //}

            //添加附加信息.
            e.Event.Tags.Add("");
            e.Event.MarkAsCritical();
        }
Exemplo n.º 20
0
        private void OnExceptionlessSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            // Only handle unhandled exceptions.
            if (!e.IsUnhandledError)
            {
                return;
            }

            // Ignore 404s
            if (e.Event.IsNotFound())
            {
                e.Cancel = true;
                return;
            }

            if (string.IsNullOrWhiteSpace(e.Event.ReferenceId) && HttpContext.Current != null)
            {
                e.Event.ReferenceId = Guid.NewGuid().ToString();
                HttpContext.Current.Items.Add("ExceptionId", e.Event.ReferenceId);
            }
        }
Exemplo n.º 21
0
        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void OnSubmittingEvent(Object sender, EventSubmittingEventArgs e)
        {
            // If we have turned off logging using the Client Config Key
            if (!e.Client.Configuration.Settings.GetBoolean("LogErrors", true))
            {
                e.Cancel = true;
                return;
            }

            if (!e.IsUnhandledError)
            {
                return;
            }

            // Ignore 404s
            //if (e.Event.IsNotFound()) {
            //    e.Cancel = true;
            //    return;
            //}
            // Ignore 401 (Unauthorized) and request validation errors.
            //if (error.Code == "401" || error.Type == "System.Web.HttpRequestValidationException") {
            //    e.Cancel = true;
            //    return;
            //}

            var error = e.Event.GetError();

            if (error == null)
            {
                return;
            }

            // Dont Log any 'TaskCanceledException in ThrowForNonSuccess A task was canceled.' errors.
            // We think this is being caused by users closing browers or timeouts. Only see it happening to api/order/uploadBase64ProofImage
            if (error.Message == "A task was canceled." && error.Type == "System.Threading.Tasks.TaskCanceledException")
            {
                e.Cancel = true;
                return;
            }
        }
Exemplo n.º 22
0
        private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            //已处理异常不处理
            if (!e.IsUnhandledError)
            {
                return;
            }

            //404不做处理
            if (e.Event.IsNotFound())
            {
                e.Cancel = true;
                return;
            }
            var error = e.Event.GetError();

            if (error == null)
            {
                return;
            }
            //401或者请求验证的错误忽略掉
            if (error.Code == "401" || error.Type == "System.Web.HttpRequestValidationException")
            {
                //取消事件
                e.Cancel = true;
                return;
            }
            //忽略任何并非由我们的代码抛出的异常
            var handledNamespaces = new List <string> {
                "Exceptionless"
            };

            if (!error.StackTrace.Select(s => s.DeclaringNamespace).Distinct().Any(o => handledNamespaces.Any(o.Contains)))
            {
                e.Cancel = true;
                return;
            }
            e.Event.Tags.Add("MunicipalPublicCenter.BusinessApi");
            e.Event.MarkAsCritical();
        }
Exemplo n.º 23
0
        /// <summary>
        /// 全局配置Exceptionless
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            //// 忽略已处理的异常
            //if (!e.IsUnhandledError)
            //{
            //    return;
            //}

            // 忽略404错误
            if (e.Event.IsNotFound())
            {
                e.Cancel = true;
                return;
            }

            // 忽略没有错误体的错误
            if (null == e.Event.GetError())
            {
                return;
            }

            e.Event.MarkAsCritical();
        }
Exemplo n.º 24
0
        private async void ExceptionlessSubmittingEvent(object sender, EventSubmittingEventArgs e)
        {
            if (!registered)
            {
                return;
            }

            if (e.IsUnhandledError)
            {
                e.Cancel = true;

                await Application.Current.Dispatcher.Invoke(async() =>
                {
                    modelHelpers.CloseAllFlyouts();

                    var resetTopMostSetting = false;
                    if (!modelHelpers.Gallifrey.Settings.UiSettings.TopMostOnFlyoutOpen)
                    {
                        modelHelpers.Gallifrey.Settings.UiSettings.TopMostOnFlyoutOpen = true;
                        resetTopMostSetting = true;
                    }

                    await modelHelpers.OpenFlyout(new Error(modelHelpers, e.Event));

                    if (resetTopMostSetting)
                    {
                        modelHelpers.Gallifrey.Settings.UiSettings.TopMostOnFlyoutOpen = false;
                    }

                    modelHelpers.CloseApp(true);
                });
            }
            else if (e.Event.IsError() || e.Event.IsCritical())
            {
                e.Event.AddTags("Handled");
            }
        }
Exemplo n.º 25
0
 private static void Default_SubmittingEvent(object sender, EventSubmittingEventArgs e)
 {
     // global submit event
 }
Exemplo n.º 26
0
 private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
 {
     // you can get access to the report here
     e.Event.Tags.Add("WebTag");
 }
Exemplo n.º 27
0
 private void OnSubmittingEvent(object sender, EventSubmittingEventArgs e) {
     // you can get access to the report here
     e.Event.Tags.Add("WebTag");
 }