feat: better error message

This commit is contained in:
2024-07-19 14:52:05 +02:00
parent a58dcdd08e
commit 47daa459e2
35 changed files with 327 additions and 89 deletions

View File

@@ -0,0 +1,19 @@
package fr.titionfire.ffsaf.rest.exception;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
@Provider
public class DetailExceptionMapper implements ExceptionMapper<DetailException> {
@Override
public Response toResponse(DetailException e) {
return Response.status(e.getStatus())
.entity(e.getMessage())
.type(MediaType.TEXT_PLAIN_TYPE)
.build();
}
}