예제 #1
0
        protected override async Task OnError(HttpContext context, Exception ex)
        {
            PreventRethrow();

            // When it's a Loxy configuration error, we should actually throw it so the developer is aware of it,
            // because it probably won't get to be logged into any sink for him to see.
            if (ex is NoSinksRegisteredException)
            {
                throw ex;
            }

            _loxy.Raise(new Event(LogLevel.Critical, "Loxy", "An unexpected exception was catched in the middleware phase end.", ex));
            await _loxy.PersistAsync();

            context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;

            throw new Exception("LOXY DEV MODE EXCEPTION (SEE INNER EX)", ex);
        }
예제 #2
0
 protected override async Task OnAfter(HttpContext context)
 {
     await _loxy.PersistAsync();
 }