title: GWT.setUncaughtExceptionHandler()
body: <p>Has anyone successfully used the above statement to catch the exception before it goes to the browser as an alert?.</p>
  
  <p>I registered a custom Exception Handler in the first line of my application entry point. But it does not catch the exception as expected.</p>
  
  <pre><code>public void onModuleLoad(){
      GWT.setUncaughtExceptionHandler(new MyExceptionHandler());
      ...
      ....
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here are my two classes:</p>
  
  <p>I expect my system.out will print the details of the exception 
  and exception will be swallowed and should not be sent to browser.</p>
  
  <p>Or Am I wrong?</p>
  
  <pre><code>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");
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>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());
      }
  }
  </code></pre>