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(); } }
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 } } }; }
public void ReportException(Exception exception) { // Update to Sentry exceptionHandlerService.ReportException(exception).Submit(); }