diff --git a/src/Api/Utilities/ExceptionHandlerFilterAttribute.cs b/src/Api/Utilities/ExceptionHandlerFilterAttribute.cs index 422bfa62d4..60506e46d0 100644 --- a/src/Api/Utilities/ExceptionHandlerFilterAttribute.cs +++ b/src/Api/Utilities/ExceptionHandlerFilterAttribute.cs @@ -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>();