Providers would also need to be registered in KeycloakApplication. We don't support that at the moment at least. You could add try/catch to your code and return an extension of WebApplicationException [1]. That way you can define how the response should look like. 

[1] https://github.com/keycloak/keycloak/blob/master/services/src/main/java/org/keycloak/services/ErrorResponseException.java

On 9 June 2016 at 12:42, Vlastimil Elias <velias@redhat.com> wrote:
Hi,

I'm implementing my own REST endpoint using RealmResourceProvider and I'm thinking how to perform error handling (which is not covered in example).
Is it possible to register my javax.ws.rs.ext.ExceptionMapper subclass to handle my exceptions? I tried to add subclass of it annotated with javax.ws.rs.ext.Provider into my code but it is not used.
I get common error page with:

Stack Trace
org.jboss.resteasy.spi.UnhandledException: com.redhat.developer.keycloak.rest.InvalidParametersException: email param must be specified

Thansk in advance.

Vlastimil

-- 
Vlastimil Elias
Principal Software Engineer
Red Hat Developer | Engineering

_______________________________________________
keycloak-dev mailing list
keycloak-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-dev