Feature/exception response (#663)

* return 500 code for other exception with json response

* not throw
This commit is contained in:
Cédric Michel
2022-01-21 16:07:11 +01:00
committed by GitHub
parent 896fae150f
commit 02b509711b

View File

@@ -41,5 +41,12 @@ public class ExceptionMiddleware
Message = duplicationException.Message
}.ToString());
}
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await context.Response.WriteAsync(new ErrorDetails()
{
StatusCode = context.Response.StatusCode,
Message = exception.Message
}.ToString());
}
}