Picking up a conversation from GWT issue 2364 - Exception not showing if
invoked from javascript in hosted mode (GWT 1.5)] See
http://code.google.com/p/google-web-toolkit/issues/detail?id=2364


There conversation started with....

Comment 
11<http://code.google.com/p/google-web-toolkit/issues/detail?id=2364#c11>
 by fredsa <http://code.google.com/u/fredsa/>, Oct 13 (3 days ago)

For those interested, JSNI exceptions are caught and logged by the
latest version of gwt-log, at least in Firefox and IE (both web and
hosted modes).

Comment 
12<http://code.google.com/p/google-web-toolkit/issues/detail?id=2364#c12>
 by sanjiv.jivan <http://code.google.com/u/sanjiv.jivan/>, Today (57 minutes
ago)

Fred, Can you provide more details? I tried including gwt-log using
debug log level and setup the UncaughtExceptionHandler but no cigar -
the native exceptions didn't get logged. What exactly is gwt-log doing
differently to have the JSNI exceptions logged? Thanks.

Sanjiv,

This should work in Firefox and IE (hosted and web modes) if you use at
least gwt-log-2.5.2. You can test the feature live by clicking the 'JavaScript
setTimeout() exception' button on the demo page:
   http://allen-sauer.com/com.allen_sauer.gwt.log.demo.LogDemo/LogDemo.html

The two source files for the online demo can be found here if you'd like to
take a closer look:
http://code.google.com/p/gwt-log/source/browse/#svn/trunk/Log/demo/com/allen_sauer/gwt/log/demo/client


As you indicated, setting the log level to DEBUG and using the gwt-log
UncaughtExceptionHandler should be sufficient:

        <!-- Add gwt-log support, default level `DEBUG` -->
        <inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />


   Log.setUncaughtExceptionHandler();




Here's the test snippet from the demos:

    jsTimeoutExceptionButtonFatal = new Button("JavaScript setTimeout()
exception [FF/IE only]");
    add(jsTimeoutExceptionButtonFatal);
    jsTimeoutExceptionButtonFatal.addClickListener(new ClickListener() {
      public native void onClick(Widget sender)
      /*-{
        setTimeout(function() {
          my_non_existant_variable.my_non_existant_method();
        }, 1);
      }-*/;
    });


Fred Sauer
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"gwt-log" 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/gwt-log?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to