diff options
Diffstat (limited to 'ExceptionMiddleware.cs')
| -rw-r--r-- | ExceptionMiddleware.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ExceptionMiddleware.cs b/ExceptionMiddleware.cs index 29d0e10..ba4049a 100644 --- a/ExceptionMiddleware.cs +++ b/ExceptionMiddleware.cs @@ -23,16 +23,16 @@ public sealed class ExceptionMiddleware { e.GetType().GetCustomAttribute<ExceptionStatusCodeAttribute>()?.StatusCode ?? StatusCodes.Status500InternalServerError; - await context.Response.WriteAsJsonAsync(e); + context.Response.Clear(); - var x = 1; + await context.Response.WriteAsJsonAsync(e); } catch(Exception) { context.Response.StatusCode = StatusCodes.Status500InternalServerError; context.Response.ContentType = "application/json"; context.Response.Clear(); - await context.Response.WriteAsync(string.Empty); + await context.Response.WriteAsJsonAsync(new ServerException()); } } } |
