Comments (15)
Ah, yes, that's definitely a case where I'd like it to rethrow the ReferenceError. I'll look into it. Thanks for the test case.
from when.
Hey @KidkArolis, I just merged a fix for this into the dev branch. Please give it a try and let me know if it works for you. If it looks good, then it'll get released as part of 1.5.1--probably early next week. Thanks!
from when.
That was quick!
Now, I think there are too many rethrows happening. I've used this dev branch in my app where I'm using when.all and several then's(), and what I get now is this output:
[object Promise 10] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 1.2.4.9] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 1.2.4.9] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 12] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 1.2.4.9] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 1.2.4.9.11] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 14] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 1.2.4.13] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 1.2.4.8] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 16] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 1.2.4.8] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
[object Promise 1.2.4.13.15] REJECTED: ReferenceError: iDontExist is not defined
debug.js:113
(8 times) Uncaught ReferenceError: iDontExist is not defined
I'm thinking, because all of these rethrows originated from the same "error instance", maybe it would be possible to detect it's already been rethrown.
from when.
But I think even this is more useful then the silent failures.
from when.
Cool, thanks for testing it out. Yeah, def too many there--note the duplicated promise ids (1.2.4.8 and 1.2.4.9), too. I'll look into ways to tone it down a bit and post again when there's something new to try.
from when.
Hm.. it seems the dev branch altered the behaviour of my application. I'm not sure if this is due to the debug changes or something else.
from when.
Yeah, I've just tried master + updated debug.js and my app is behaving differently, so this new debug.js version is changing something, I'll try to see what exactly is happening.
from when.
One of the promises is getting resolved twice, I'll try to narrow it down.
from when.
Strange! Yeah, def let me know if you can track down the cause, or even get more info. Have you verified that your app works correctly with 1.5.0 in non-debug mode? There was a change to deferred.resolve/reject in 1.5.0. In non-debug mode they return silently now when you call them multiple times, whereas previously they threw. They will still throw in debug mode, tho (or at least they should!).
from when.
Yeah, then'ed callbacks are called twice now
var when = require("when");
var d = when.defer();
var count = 0;
when(d).then(function () {
count += 1;
});
d.resolve();
count === 2;
from when.
Wow, ok, that's not good :) I verified that it's only in debug mode using your test ... normal mode seems to work correctly. Looks like I've got some work to do before 1.5.1 :)
from when.
Haha, it's a dumb mistake on my part in when/debug. I just pushed a fix for the double callbacks. Please try the dev branch again when you have a chance. If that's back to normal, I'll focus on slimming down the debug output.
from when.
Seems to be working better now.
And my output is not duplicated:
[object Promise 1.2.3.6] REJECTED: ReferenceError: iDontExist is not defined debug.js:110
[object Promise 1.2.3.5] REJECTED: ReferenceError: iDontExist is not defined debug.js:110
[object Promise 1.2.3.6.7] REJECTED: ReferenceError: iDontExist is not defined debug.js:110
(2 times) Uncaught ReferenceError: iDontExist is not defined
I'll use this dev branch in my dev now and see how it goes.
from when.
Great. We'll probably go with what's in the dev branch now for 1.5.1. For 2.0, we will probably take a fresh look at debugging to see if there are other interesting approaches (it's all pretty brute force, right now). If you have ideas for what kind of information would be helpful while debugging promise code, I'd love to hear them!
If the original issue is fixed in dev, feel free to close this ticket, or wait until 1.5.1 is released to verify. Whichever you prefer.
from when.
Just released 1.5.1 so closing this as I believe the original issue is fixed. If not, please reopen!
from when.
Related Issues (20)
- Cannot resolve module 'vertx' HOT 9
- JSPM build (SystemJS builder) failing on [email protected] HOT 3
- Does not work in NodeJS (ReactJS Native) HOT 12
- Visual Studio debugger breakes from adding When to WebPack bundle. HOT 13
- 3.7.7 breakes the build on Windows HOT 2
- no such file or directory .... es6-shim/makePromise HOT 2
- Global rejection events completely broken in a bundled environment (eg. Webpack)
- When not working in Jasmine tests
- when.reduce UnhandledPromiseRejectionWarning HOT 4
- Misleading unhandled rejection warning when using when.settle HOT 10
- npm install ! has errors HOT 1
- Usage hello world example fails with TypeError HOT 3
- Binding context to promise chain HOT 2
- Add react-native support HOT 2
- File 404 when try to use in browser environment
- Promise.js first function never runs HOT 2
- RTE TypeError after production build HOT 4
- Does function call also accept promises? HOT 4
- Current project status HOT 1
- npm install failing with 404 error code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from when.