Exemple #1
0
        public void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs
            var exception = Context.Server.GetLastError() ?? Context.AllErrors.FirstOrDefault();

            if (exception != null)
            {
                // Update to Sentry
                exceptionHandlerService.ReportException(exception).Submit();
            }
        }
Exemple #2
0
        protected override void OnException(ExceptionContext filterContext)
        {
            filterContext.ExceptionHandled = true;

            exceptionHandlerService.ReportException(filterContext.Exception).Submit();

            filterContext.Result = new ViewResult
            {
                ViewName = "~/Views/Shared/Error.cshtml",
                ViewData = new ViewDataDictionary(filterContext.Controller.ViewData)
                {
                    Model = new ErrorVM {
                        Exception = filterContext.Exception
                    }
                }
            };
        }
Exemple #3
0
 public void ReportException(Exception exception)
 {
     // Update to Sentry
     exceptionHandlerService.ReportException(exception).Submit();
 }