I have a custom authentication handler, which checks the username/pass against an elasticsearch datastore. Everything works fine, but if from some reason the ES would be down I want to throw an exception saying that the system is currently down. I've tried with any subclass of GeneralSecurityException or PreventedException which the method authenticateUsernamePasswordInternal() are throwing, but the result in the UI is always Invalid Credentials. I've also tried with a runtime exception, but with the same result. Is there any way how I can handle this to display any other message?