Open ksrb opened 9 years ago
I think this is a pretty well know problem with JQuery but I didn't see any open issues when I searched "promises", so apologies if you guys are already aware of this issue.
The below are samples from a working gist.
Problem 1: Error handling Errors are not being passed to next then(), or even bubbling up to the application at all, did I use the api wrong?
private void errorHandling() { final Promise promise = timeOut(1000); promise.then(new Function() { public void f() { throw new Error("I want to fail"); } }, new Function() { public void f() { log.info("Not here? Nope"); } }).fail(new Function() { public void f() { log.info("How about here? Nope"); } }); }
In the above the error seems to just disappear...
Problem 2: Execution order
private void executionOrder() { log.info("This"); final Promise promise = timeOut(1000); promise.then(new Function() { public void f() { log.info("expected from an async api"); } }); log.info("is"); Timer timer = new Timer() { @Override public void run() { log.info("He"); promise.then(new Function() { public void f() { log.info("BAD THINGS"); } }); log.info("comes"); } }; timer.schedule(2000); }
The expected console output should be:
This is expected from an async api He comes BAD THINGS
But the actual is:
This is expected from an async api He BAD THINGS comes
Additional Information GWT: 2.7 GWTQuery: 1.4.4 - snapshot (1/30/2015)
I think this is a pretty well know problem with JQuery but I didn't see any open issues when I searched "promises", so apologies if you guys are already aware of this issue.
The below are samples from a working gist.
Problem 1: Error handling Errors are not being passed to next then(), or even bubbling up to the application at all, did I use the api wrong?
In the above the error seems to just disappear...
Problem 2: Execution order
The expected console output should be:
But the actual is:
Additional Information GWT: 2.7 GWTQuery: 1.4.4 - snapshot (1/30/2015)