feat: better error message
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user