diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-06-15 10:35:47 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-06-15 10:35:47 +1000 |
| commit | e556de927015acd8d9934e68707a95901acfad8e (patch) | |
| tree | c04e9601a15cff5f1fe9980e8f2ff41bae351635 /ExceptionMiddleware.cs | |
| parent | df4bfad33e1b3fc2ce35af8000380029ecb444cf (diff) | |
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()); } } } |
