Beispiel #1
0
        private async Task HandleErrorAsync(HttpContext context, Exception exception)
        {
            var errorResult = ErrorResult.MapFromException(exception);

            context.Response.StatusCode  = (int)errorResult.StatusCode;
            context.Response.ContentType = "application/json";
            await JsonSerializer.SerializeAsync(context.Response.Body, errorResult);
        }