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

ca.ibodrov.mica.server.exceptions.DataAccessExceptionMapper Maven / Gradle / Ivy

The newest version!
package ca.ibodrov.mica.server.exceptions;

import org.jooq.exception.DataAccessException;
import org.sonatype.siesta.Component;

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

public class DataAccessExceptionMapper implements Component, ExceptionMapper {

    @Override
    public Response toResponse(DataAccessException exception) {
        return Response.serverError()
                .entity(new InternalError(exception.getMessage()))
                .build();
    }

    public record InternalError(String message) {
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy