bugfix unhandled ex in case of duplicateexception (#862)

Co-authored-by: Florian Mader <florian.mader@outlook.com>
This commit is contained in:
flomader
2023-02-28 20:55:56 +01:00
committed by GitHub
parent 2f07effa18
commit be413887a1

View File

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