22 lines
722 B
Java
22 lines
722 B
Java
package fr.titionfire.ffsaf.rest.exception;
|
|
|
|
import jakarta.ws.rs.core.MediaType;
|
|
import jakarta.ws.rs.core.Response;
|
|
import org.jboss.resteasy.reactive.server.ServerExceptionMapper;
|
|
import org.jboss.resteasy.reactive.server.UnwrapException;
|
|
|
|
import java.util.concurrent.CompletionException;
|
|
|
|
@UnwrapException({CompletionException.class, RuntimeException.class})
|
|
public class DetailExceptionMapper{
|
|
|
|
@ServerExceptionMapper
|
|
public Response mapException(DetailException e) {
|
|
System.out.println("DetailExceptionMapper: " + e.getMessage());
|
|
return Response.status(e.getStatus())
|
|
.entity(e.getMessage())
|
|
.type(MediaType.TEXT_PLAIN_TYPE)
|
|
.build();
|
|
}
|
|
}
|