Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use plain object for exception mapping #3647

Merged
merged 8 commits into from
Feb 3, 2025
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package com.bakdata.conquery.io.jetty;

import com.bakdata.conquery.models.error.ConqueryError;
import com.bakdata.conquery.models.error.SimpleErrorInfo;

import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;

public class ConqueryErrorExceptionMapper implements ExceptionMapper<ConqueryError> {
@Override
public Response toResponse(ConqueryError exception) {
return Response.status(Response.Status.BAD_REQUEST.getStatusCode())
.type(MediaType.APPLICATION_JSON_TYPE)
.entity(exception)
.build();
SimpleErrorInfo plain = exception.asPlain();

return Response.status(Response.Status.BAD_REQUEST.getStatusCode())
.type(MediaType.APPLICATION_JSON_TYPE)
.entity(plain)
.build();
}
}
Loading