All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.redpipe.example.wiki.keycloakJooq.ApiExceptionMapper Maven / Gradle / Ivy

package net.redpipe.example.wiki.keycloakJooq;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import io.vertx.core.json.JsonObject;

@Provider
public class ApiExceptionMapper implements ExceptionMapper {

	@Override
	public Response toResponse(ApiException exception) {
		JsonObject response = new JsonObject();
		response
		.put("success", false)
		.put("error", exception.getMessage());
		return Response.status(exception.getStatus()).entity(response).build();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy