feat: better error message
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package fr.titionfire.ffsaf.rest.exception;
|
||||
|
||||
import fr.titionfire.ffsaf.utils.KeycloakException;
|
||||
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 KeycloakExceptionMapper implements ExceptionMapper<KeycloakException> {
|
||||
|
||||
@Override
|
||||
public Response toResponse(KeycloakException e) {
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
|
||||
.entity("Erreur du gestionnaire d'identité: " + e.getMessage())
|
||||
.type(MediaType.TEXT_PLAIN_TYPE)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user