[keycloak-dev] Exception handling for own REST API - is it possible to register own javax.ws.rs.ext.ExceptionMapper?

Vlastimil Elias velias at redhat.com
Mon Jun 13 04:33:18 EDT 2016


Thanks, looks good. Maybe your REST example should be extended to 
contain example of error handling using this exception.

Cheers

Vlastimil


On 13.6.2016 08:56, Stian Thorgersen wrote:
> 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 at redhat.com 
> <mailto:velias at 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 at lists.jboss.org <mailto:keycloak-dev at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/keycloak-dev
>
>

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20160613/4ec33e60/attachment-0001.html 


More information about the keycloak-dev mailing list