Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8553935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:46:03+00:00 2026-06-11T14:46:03+00:00

I use Vaadin framework to create my web application GUI. I have a Vaadin

  • 0

I use Vaadin framework to create my web application GUI.

I have a Vaadin button and its click listener code may throw an application custom exception. In other points of application code, this exception is thrown all the way back to my custom window class, where it’s centrally handled. I’d like to do something similar here: throw this exception in the clickListener code, so I could catch it in my custom terminal error handler in the window class. As the click listener class does not throw any exception, I’m unable to throw the exception there and I think I’ll be obliged to handle the exception locally. As I don’t want to handle the exception at the button click listener level, I think I’ll forward it to my custom window class. Something like this:

Button btnNew = new Button("New", new Button.ClickListener() {
  public void buttonClick(ClickEvent event) {
    try {
        doThingThatThrowsException();
    } catch (Exception exc) {
        window.handleCustomException()
    }
  }
});

Is this the usual way of centralizing handling of a custom exception using Vaadin?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:46:04+00:00Added an answer on June 11, 2026 at 2:46 pm

    I can’t answer as to whether it’s the usual way of handling the exception, but we do something very similar.

    Depending on how many listeners or how often you have to do this, you could also create abstract listeners that do that delegation for you.

    e.g.

    abstract class BasicListener {
      protected void handleThrowable(Component.Event event, Throwable throwable) {
        Window window = event.getComponent().getWindow();
        if (window instanceof ExceptionHandlingWindow) {
          ((ExceptionHandlingWindow) window).handleException(throwable);
        } else {
          // Log it ? DO something, anyway.
        }
      }
    }
    
    abstract class ExceptionHandlingButtonClickHandler extends BasicListener implements Button.ClickListener {
      @Override
      public void buttonClick(Button.ClickEvent event) {
        try {
          handleClick(event);
        } catch (Throwable e) {
          handleThrowable(event, e);
        }
      }
    
      protected abstract void handleClick(Button.ClickEvent event);
    }
    
    Button btnNew = new Button("New", new ExceptionHandlingButtonClickHandler() {
      @Override
      protected void handleClick(Button.ClickEvent event) {
        doThingThatThrowsException();
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am going to use Vaadin UI framework to develop web application where indexing
I'm going to develop a web application using SmartGWT. I've heard about Vaadin framework.
I am working on a vaadin application in which I have to use JasperReports.
Is it possible to use widgets from the Vaadin-framework from within a GWT application?
I have created a simple java web (Vaadin) application project using JPA and it
I am planning to use vaadin to develop internal application, which will be used
What Web Framework would you use to realize the the interface of the following
I have a vaadin table where I use certain filters for filtering, just like
I am using vaadin framework, I can use the com.vaadin.ui.Accordion library for Accordion. By
I use Eclipse Indigo (EE) to build applications in Java framework Vaadin, using Tomcat

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.