On Mon, Jan 5, 2009 at 8:37 AM, blissteria <[email protected]> wrote:
> Let foo.js a javascript file containing:
> function MyObject(){
>  throw "String Thrown";
> };
>
> In my Module.gwt.xml I add the following line to include the script
> <script src="foo.js" />
>
> Then in any java file of my application, in the click method of a
> clickListener for instance, I call the function "createMyObject"
> defined as:
> public native void createMyObject()/*-{
>  new $wnd.MyObject();
> }-*/;
>
> The call of this function is surrounded by a try/catch block :
> try {
>  createMyObject();
> }
> catch (Exception e){
>  Window.alert(e);
> }
>
> This works fine in firefox 2 and 3  but not in IE (6 and 7). In IE I
> got an "exception rised but not caught" error and therefore no
> alert...
>
> What do you think of this problem?

I'm just guessing here because I don't know how GWT maps native
Javascript "exceptions" into Java.  I think your problem might be
related to the fact that you're throwing a string, not an Exception
and you're catching an Exception, not a string.

Do you have control over the script you're trying to include?  Can you
modify the throw statement to call into a Java method that throws a
"real" exception?  Could you factor the throw statement into a helper
function that gets substituted by a JSNI method when the script is
invoked from a GWT app?

Ian

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to