Beispiel #1
0
        public async Task Invoke(HttpContext context)
        {
            try
            {
                await _next.Invoke(context);
            }
            catch (Exception ex)
            {
                context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
                _logger.LogError(LogEvents.ApiExceptionHandler, ex, _exResolver.GetInnerMessage(ex));

                await context.Response.WriteAsync(_converter.ConvertToJson(_response
                                                                           .AddException(ex)
                                                                           .Get()));
            }
        }