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:
parent
119c815c16
commit
22201bf30a
@ -92,6 +92,19 @@ public class ExceptionHandlerFilterAttribute : ExceptionFilterAttribute
|
|||||||
errorMessage = "Unauthorized.";
|
errorMessage = "Unauthorized.";
|
||||||
context.HttpContext.Response.StatusCode = 401;
|
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
|
else
|
||||||
{
|
{
|
||||||
var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<ExceptionHandlerFilterAttribute>>();
|
var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<ExceptionHandlerFilterAttribute>>();
|
||||||
|
Loading…
Reference in New Issue
Block a user