Skip to content

Commit

Permalink
bugfix unhandled ex in case of duplicateexception (dotnet-architectur…
Browse files Browse the repository at this point in the history
…e#862)

Co-authored-by: Florian Mader <florian.mader@outlook.com>
flomader and flomader authored Feb 28, 2023
1 parent 2f07eff commit be41388
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/PublicApi/Middleware/ExceptionMiddleware.cs
Original file line number Diff line number Diff line change
@@ -41,12 +41,14 @@ await context.Response.WriteAsync(new ErrorDetails()
Message = duplicationException.Message
}.ToString());
}

context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await context.Response.WriteAsync(new ErrorDetails()
else
{
StatusCode = context.Response.StatusCode,
Message = exception.Message
}.ToString());
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
await context.Response.WriteAsync(new ErrorDetails()
{
StatusCode = context.Response.StatusCode,
Message = exception.Message
}.ToString());
}
}
}

0 comments on commit be41388

Please sign in to comment.