Browse Source

bugfix unhandled ex in case of duplicateexception (#862)

Co-authored-by: Florian Mader <florian.mader@outlook.com>
main
flomader 3 years ago
committed by GitHub
parent
commit
be413887a1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/PublicApi/Middleware/ExceptionMiddleware.cs

14
src/PublicApi/Middleware/ExceptionMiddleware.cs

@ -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());
}
} }
} }

Loading…
Cancel
Save