public IActionResult Index() { ElmahExtensions.RaiseError(new InvalidOperationException("This is the Test Exception from code.")); _logger.LogTrace("Test"); _logger.LogDebug("Test"); _logger.LogError("Test"); _logger.LogInformation("Test"); _logger.LogWarning("Test"); _logger.LogCritical(new InvalidOperationException("Test"), "Test"); ElmahExtensions.RaiseError(new NullReferenceException()); if (DateTime.Now.Millisecond < 500) { string str = null; // ReSharper disable once PossibleNullReferenceException foreach (var cc in str) { Debug.WriteLine(cc); } } var r = 0; // ReSharper disable once UnusedVariable // ReSharper disable once IntDivisionByZero var d = 100 / r; return(View()); }
public void RiseErrorExceptionWhenMiddlewareNotInitialised() { var httpContext = new DefaultHttpContext(); Func <Task> act = async() => await ElmahExtensions.RaiseError(httpContext, new Exception()); act.Should().ThrowAsync <MiddlewareNotInitializedException>(); }
/// inheritDoc public void HandleEvent(AbpHandledExceptionData eventData) { if (eventData.Exception != null && !eventData.Exception.IsExceptionLogged()) { ElmahExtensions.RiseError(eventData.Exception); eventData.Exception.MarkExceptionAsLogged(); } }
public void RiseErrorOkWhenMiddlewareInitialized() { var _ = new ErrorLogMiddleware(_requestDelegate, _errorLog, _loggerFactory, _options); var httpContext = new DefaultHttpContext(); Func <Task> act = async() => await ElmahExtensions.RaiseError(httpContext, new Exception()); act.Should().NotThrowAsync(); }
public async Task <bool> tryCommitAsync() { try { await commitAsync(); } catch (Exception e) { ElmahExtensions.RiseError(e); new InvalidOperationException("exception", e); return(false); } return(true); }
public async Task Invoke(HttpContext context) { try { await _next.Invoke(context); } catch (Exception ex) { ElmahExtensions.RiseError(new Exception(ex.Message, ex.InnerException)); } }
protected override void Append(LoggingEvent loggingEvent) { var exception = loggingEvent.ExceptionObject; if (exception == null || loggingEvent.ExceptionObject.IsExceptionLogged()) { return; } ElmahExtensions.RiseError(exception); }
public void OnGet() { _logger.LogTrace("Test"); _logger.LogDebug("Test"); _logger.LogError("Test"); _logger.LogInformation("Test"); _logger.LogWarning("Test"); _logger.LogCritical(new InvalidOperationException("Test"), "Test"); ElmahExtensions.RaiseError(new Exception("test2")); var r = 0; // ReSharper disable once UnusedVariable // ReSharper disable once IntDivisionByZero var d = 100 / r; }
public IActionResult Index() { /*_logger.LogTrace("Test"); * _logger.LogDebug("Test"); * _logger.LogError("Test"); * _logger.LogInformation("Test"); * _logger.LogWarning("Test");*/ _logger.LogCritical(new InvalidOperationException("Test"), "Test"); ElmahExtensions.RiseError(new Exception("test2")); var r = 0; // ReSharper disable once UnusedVariable // ReSharper disable once IntDivisionByZero var d = 100 / r; return(View()); }
public static void ManageExceptionContext(Exception ex) { ElmahExtensions.RiseError(ex); }