how I can catch ALL exceptions

Hi,

Is there any possibility to catch exceptions not cached by anyone. For example, if I do not want to put try-cacth-blocks to every listener of buttons. I want to avoid a situation that user sees the whole stacktrace.

Thanks beforehand!

-T

Hi,

If I understood correctly you do not want the user to see ‘component-errors’, which are those small icons appearing next to a component where the error occured.

If you would like to customize the error handling in your application you can override the terminalError-method in your application class (that extends Application). Some code:


    @Override
    public void terminalError(Terminal.ErrorEvent event) {
        
       // Get the exception
       Throwable throwable = event.getThrowable();

       // Log exception
       log(throwable);

       // Tell the user that internal error has occured
       Label label = new Label("Internal error!!");

       // Show the label...
       
       ....

    }

Hope this helps.

-Jukka

If I remember correctly there is a exception handler callback in Application class that could be utilized here.

See:
http://toolkit.itmill.com/demo/doc/api/com/itmill/toolkit/Application.html#terminalError(com.itmill.toolkit.terminal.Terminal.ErrorEvent)