+1 for JIRA. Also feel free to send PR as you already nail it down and you already send some PRs :-) 

By the way, Thanks for them.

It seems that generally we should improve on handling errors from admin REST endpoints. Ideally you can handle the error response similarly like it's done here: https://github.com/keycloak/keycloak/blob/master/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java#L771 . Then on admin-client side, you can catch ClientErrorException and see the error message for example like done here: https://github.com/keycloak/keycloak/blob/master/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java#L49

Thanks,
Marek

On 6.5.2015 19:31, Leonardo Loch Zanivan wrote:
Unfortunatelly I think it's not possible right now.

Admin client uses Admin REST API, which isn't handling errors correctly.

If you try to reset a password using Admin interface you will get a generic error 500 saying "Failed to reset user password".

In the server the stacktrace shows:
Caused by: org.jboss.resteasy.spi.UnhandledException: org.keycloak.models.ModelException: invalidPasswordMinLengthMessage

We could fill a JIRA to handle ModelException using JAX-RS exception handlers, so the response will have the correct error and we could show a better error message.

On Wed, May 6, 2015 at 2:10 PM Benjamin Hansmann [alphaApps] <b.hansmann@alphaapps.de> wrote:
Is one able to get an error message from the resetPassword method of
admin-client if it somehow failed to reset the password, like when the
password is too short or does not comply with the password policy?

It throws an InternalServerErrorException in that case. On the server
side there seems to be a ModelException:
invalidPasswordMinLengthMessage. That information is lost...


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


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