I have login button that calls a login function
if (button == loginbutton) {
try {
login();
} catch (Exception e) {
// I am adding a window compnent here that will display the exception with the message
}
}
Now my login function:
private void login() throws Exception {
accessInterface.signIn(m_username.getValue(), m_password.getValue());
m_loginListener.loginSuccessful();
}
now it goes to signin function:
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;
}
now it goes to authenticate method of the service:
public static uInterface authenticate(String p_username, String p_password, String p_Location) throws Exception {
// here it is authenticating user
}
Now, the problem is that it is not showing the error or exception in that window component. What should i do? I want to catch my exception in that window component vaadin
Windows Code
It takes ui object, windows Heading, Message and then details of exception on click of details button
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);
}
}
);
The SetErrorHandler in vaadin does the trick to catch this Error