use of com.bakdata.quick.common.api.model.ErrorMessage in project quick by bakdata.
the class CompositeExceptionHandler method handle.
@Override
public HttpResponse<ErrorMessage> handle(final HttpRequest request, final CompositeException exception) {
final StringBuilder messageBuilder = new StringBuilder();
exception.getExceptions().forEach(nestedException -> reduceErrorMessages(messageBuilder, nestedException));
final ErrorMessage errorMessage = ErrorMessage.builder().type("errors/composite").title(exception.getExceptions().size() + " errors occurred").uriPath(request.getPath()).detail(messageBuilder.toString()).code(500).build();
return HttpResponse.serverError(errorMessage);
}
Aggregations