Search in sources :

Example 6 with ErrorMessage

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);
}
Also used : ErrorMessage(com.bakdata.quick.common.api.model.ErrorMessage)

Aggregations

ErrorMessage (com.bakdata.quick.common.api.model.ErrorMessage)6 SchemaData (com.bakdata.quick.common.api.model.gateway.SchemaData)1 JsonError (io.micronaut.http.hateoas.JsonError)1 MicronautTest (io.micronaut.test.extensions.junit5.annotation.MicronautTest)1 AvroMissingFieldException (org.apache.avro.AvroMissingFieldException)1 AvroTypeException (org.apache.avro.AvroTypeException)1 UnresolvedUnionException (org.apache.avro.UnresolvedUnionException)1 Test (org.junit.jupiter.api.Test)1 AvroConversionException (tech.allegro.schema.json2avro.converter.AvroConversionException)1