-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw JS exception instead of Java wrapping object #23
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, are you sure about this? Can you put together a quick test that confirms this?
I'm asking because this is pretty nearly (but not exactly) what GWT's own Impl.reportToBrowser does in a case like this, directly throw the throwable
instance, right? The Throwable overload first unwraps any JavaScriptException to find the underlying object that was thrown from plain JS, but if it was a "real" Java exception it is just thrown directly. That is, it doesn't unwrap "real" exceptions to the backing object.
Is #20 specifically about native exceptions? If so, we might have a hard time making that work as expected in both GWT and J2CL.
ThrowableTestBase has some handy methods to verify the various important cases, might be worth stealing bits of it here.
By the time exceptions reach
I guess replicating GWT 2's scheduler is hard, but why not always unwrap (as this PR does)? |
Mostly I'm hoping for unit tests here so we can validate those with any patch - and see if we can find a simpler way to achieve the desired effect. Specifics are going to be slightly different from JSNI to jsinterop as jsni strongly encouraged the use of $entry (which was part of Impl.java). They also may vary slightly between GWT and J2CL generated exceptions. |
The functionality changed here is similar to the stuff tested in https://github.com/gwtproject/gwt/blob/c2229e7557450cd2842269f5fe9cb8586e90b50c/user/test/com/google/gwt/core/client/WindowOnErrorTest.java#L34 , I'll try to implement a similar test here. |
Fixes #20