Browse Source
Feature/exception response (#663)
* return 500 code for other exception with json response
* not throw
main
Cédric Michel
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
1 deletions
-
src/PublicApi/Middleware/ExceptionMiddleware.cs
|
|
@ -41,5 +41,12 @@ public class ExceptionMiddleware |
|
|
Message = duplicationException.Message |
|
|
Message = duplicationException.Message |
|
|
}.ToString()); |
|
|
}.ToString()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; |
|
|
|
|
|
await context.Response.WriteAsync(new ErrorDetails() |
|
|
|
|
|
{ |
|
|
|
|
|
StatusCode = context.Response.StatusCode, |
|
|
|
|
|
Message = exception.Message |
|
|
|
|
|
}.ToString()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|