异常处理 vaadin

Exception handling vaadin

我有调用登录函数的登录按钮

if (button == loginbutton) {
    try {
        login();
    } catch (Exception e) {
        // I am adding a window compnent here that will display the exception with the message
    }
}

现在我的登录功能:

private void login() throws Exception {
    accessInterface.signIn(m_username.getValue(), m_password.getValue());
    m_loginListener.loginSuccessful();  
}

现在进入登录功能:

public boolean signIn(String p_username, String p_password) throws Exception {
    try {
        m_user = UserAuthentication.authenticate(p_username, p_password, 
                ServiceSettings.getInstance().getAuthenticationServiceLocation());


    } catch (Exception e) {
        m_logger.error("CATCH",e);
        throw e;
    }
    // Setting the current user
    CurrentUser.set(m_user); 
    return true;
}

现在转到服务的身份验证方法:

public static uInterface authenticate(String p_username, String p_password, String p_Location) throws Exception {
    // here it is authenticating user

}

现在,问题是它没有显示 window 组件中的错误或异常。我应该怎么办?我想在 window 组件 vaadin

中捕获我的异常

Windows代码

需要 ui object、windows 标题、消息以及点击详细信息按钮时的异常详细信息

ExceptionDetails.showMessage(getUI(), 
    "Error in signing in", 
    "ExceptionInformation", 
    e.getLocalizedMessage(), 
    new ActionListenerDetail() {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClickDetails() {
            m_username.focus();
            m_loginButton.setEnabled(true);
        }
    }
);

vaadin 中的 SetErrorHandler 可以捕获此错误