1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-11 20:10:38 +01:00

[EC-619] Exceeding seat limit results in vague "Unhandled server error" message (#2558)

* [EC-619] Added 'AggregateException' type to ExceptionHandlerFilter to return error messages in response

* [EC-619] Updated ExceptionHandlerFilterAttribute to return multiple errors using ErrorResponseModel internal property
This commit is contained in:
Rui Tomé 2023-01-18 09:56:08 +00:00 committed by GitHub
parent 119c815c16
commit 22201bf30a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,6 +92,19 @@ public class ExceptionHandlerFilterAttribute : ExceptionFilterAttribute
errorMessage = "Unauthorized.";
context.HttpContext.Response.StatusCode = 401;
}
else if (exception is AggregateException aggregateException)
{
context.HttpContext.Response.StatusCode = 400;
var errorValues = aggregateException.InnerExceptions.Select(ex => ex.Message);
if (_publicApi)
{
publicErrorModel = new ErrorResponseModel(errorMessage, errorValues);
}
else
{
internalErrorModel = new InternalApi.ErrorResponseModel(errorMessage, errorValues);
}
}
else
{
var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<ExceptionHandlerFilterAttribute>>();