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 860703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:51:21+00:00 2026-05-15T08:51:21+00:00

Has anyone successfully used the above statement to catch the exception before it goes

  • 0

Has anyone successfully used the above statement to catch the exception before it goes to the browser as an alert?.

I registered a custom Exception Handler in the first line of my application entry point. But it does not catch the exception as expected.

public void onModuleLoad(){
    GWT.setUncaughtExceptionHandler(new MyExceptionHandler());
    ...
    ....
}

EDIT

Here are my two classes:

I expect my system.out will print the details of the exception
and exception will be swallowed and should not be sent to browser.

Or Am I wrong?

package mypackage;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;

public class MyEntryPoint implements EntryPoint {

    public void onModuleLoad() {
    GWT.setUncaughtExceptionHandler(new ClientExceptionHandler());
    startApplication();
    }

    private void startApplication() {
    Integer.parseInt("I_AM_NOT_NUMBER");
    }
}

package mypackage;

import com.google.gwt.core.client.GWT;

public class ClientExceptionHandler implements GWT.UncaughtExceptionHandler {

    @Override
    public void onUncaughtException(Throwable cause) {
    System.out.println(cause.getMessage());
    }
}
  • 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-05-15T08:51:22+00:00Added an answer on May 15, 2026 at 8:51 am

    I believe what’s happening here is that the current JS event cycle is using the DefaultUncaughtExceptionHandler because that was the handler set at the start of the cycle. You’ll need to defer further initialization to the next event cycle, like this:

    public void onModuleLoad() {
        GWT.setUncaughtExceptionHandler(new ClientExceptionHandler());
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            @Override
            public void execute() {
               startApplication();
               Window.alert("You won't see this");
            }
        });
    }
    
    private void startApplication() {
        Integer.parseInt("I_AM_NOT_A_NUMBER");
        // or any exception that results from server call
    }
    

    Update: And here’s the issue that describes why this works, and why it isn’t planned to be fixed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone successfully used WebKit in Delphi? WebKit is an open source web browser
Has anyone successfully used Django unit tests with custom table names? If so, were
Has anyone successfully used Tokyo Cabinet / Tokyo Tyrant with large datasets? I am
I'm just curious to know if anyone has used (successfully) Fusion Charts with Open
Has anyone successfully used JBoss Web SingleSignOn with JBoss Seam, or know if it
I want to know if anyone has successfully used a time on page approach
Has anyone successfully used the jquery plugin wysiwyg ver 0.97 to call an event
Has anyone successfully used the AJAX-enabled ASP.NET Web Application wizard in Delphi 2007 to
has anyone successfully used the jQuery ui.layout plugin to load jQuery mobile inside the
Has anyone used primefaces data exporter component successfully with primefaces datatable with dynamic columns?

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.