Validation Error Notificaiton

I’m new to vaadin. I’m curious how to get a notification/callback if form validation fails.

Thanks,

Douglas

try {
       form.validate();
} catch (InvalidValueException e) {
        mainWindow.showNotification(e.getMessage());
}