public async Task <IActionResult> Error([FromServices] ILoggingService logging) { try { var error = HttpContext.Features.Get <IExceptionHandlerFeature>().Error; var path = HttpContext.Features.Get <AliseeksFE.Middleware.LoggerFeature>().Path; var model = new LoggingExceptionModel() { Criticality = 5, Message = $"Query: {path}\n{error.Message}", StackTrace = error.StackTrace }; await logging.LogException(model); await raven.CaptureNetCoreEventAsync(error); } catch (Exception e) { logger.LogError(new EventId(501), e, "ERROR IN ERROR LOGGER"); } return(View()); }
public async Task <HttpResponseMessage> LogException(LoggingExceptionModel model) { StringContent content = new StringContent(JsonConvert.SerializeObject(model)); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); return(await api.Post(ApiEndpoints.LoggingException, content)); }