Moorsu,

Sorry to leave you hanging on StackOverflow. I didn't see your code sample,
as I've just explained over
there<http://stackoverflow.com/questions/3028521/gwt-setuncaughtexceptionhandler>
.

This behavior is described in issue
#1617<http://code.google.com/p/google-web-toolkit/issues/detail?id=1617>.
In a nutshell, you need to set the handler and then defer the rest of
onModuleLoad to the next event cycle.

GWT.setUncaughtExceptionHandler(new ClientExceptionHandler());
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
startApplication(); // causes an exception
Window.alert("You won't see this");
}
});

Hope that helps.

- Isaac

On Tue, Jun 29, 2010 at 10:27 AM, moorsu <moo...@gmail.com> wrote:

> Hi,
>
> I already posted this question to stackoverflow. Posting again
> here since I did not get any working answer. Sorry for the
> duplicate post.
>
> I registered my custom UncaughtExceptionHandler to catch
> all the client/server side runtime exceptions. The
> handler does not catch them, but simply sending it to
> browser.
>
> Did I my understood the UncaughtExceptionHandler functionality
> or any other issue?
>
> -thanks
> moorsu.
>
> Here is my code.
>
>
> // ------------ Class 1 -------------------------------
>
> 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_A_NUMBER");
>         // or any exception that results from server call
>     }
> }
>
> // --------------- Class 2 -----------------------------
>
> package mypackage;
>
> import com.google.gwt.core.client.GWT;
>
> public class ClientExceptionHandler implements GWT.UncaughtExceptionHandler
> {
>
>     public void onUncaughtException(Throwable cause) {
>
>         System.out.println(cause.getMessage());
>     }
> }
>
> // --------------------------------------------------------------
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to