Dear Isaac, Wonderful!. Your solution is working well.
Thanks a lot!. -Moorsu On Tue, Jun 29, 2010 at 8:32 PM, Isaac Truett <[email protected]> wrote: > 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 <[email protected]> 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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<google-web-toolkit%[email protected]> >> . >> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-web-toolkit%[email protected]> > . > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
