Throw JS exception instead of Java wrapping object#23
Throw JS exception instead of Java wrapping object#23zbynek wants to merge 2 commits intogwtproject:masterfrom
Conversation
niloc132
left a comment
There was a problem hiding this comment.
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