Comments (9)
Yes, I would love to see long stack traces implemented. We can use Q as a good example of a library that already implements them. We should make them disabled by default and allow people to require('promise/lib/long-stack-traces')
if they want them enabled.
from promise.
Can you help me understand this stacktrace:
ERROR Cannot read property 'length' of null
TypeError: Cannot read property 'length' of null
at Promise._94 (react-native-github/node_modules/promise/lib/core.js:138:31)
at Promise._82 (react-native-github/node_modules/promise/lib/core.js:129:8)
at react-native-github/node_modules/promise/lib/core.js:97:24
at flush (react-native-github/node_modules/promise/node_modules/asap/raw.js:50:29)
at process._tickCallback (node.js:415:13)
from promise.
Apparently it's a race. After tracing back this call stack to the original source it seems that asap
is calling twice (and finalizing) on the same promise. If I change a part of my code from Promise.all to a serial chain this works fine.
from promise.
Interesting. Can you share the code to reproduce this? It sounds like this might be related to #93 but I was never able to get code to reproduce that.
from promise.
let me try and boil it down to something reproducible.
Another random thought, could this be an issue with interop with a different promise library like bluebird?
from promise.
It's definitely possible. Either way I really want to get to the bottom of it. If there's a bug in asap or this lib then finding it would be a huge win.
from promise.
I've reconstructed as much as I can of what the original stack trace should look like. Unfortunately it doesn't tell me much extra:
TypeError: Cannot read property 'length' of null
at Promise._finale (react-native-github/node_modules/promise/lib/core.js:138:31)
at Promise._resolve (react-native-github/node_modules/promise/lib/core.js:129:8)
at react-native-github/node_modules/promise/lib/core.js:97:24
at flush (react-native-github/node_modules/promise/node_modules/asap/raw.js:50:29)
at process._tickCallback (node.js:415:13)
From previous event:
at Promise._handle (react-native-github/node_modules/promise/lib/core.js:87)
from promise.
I couldn't reproduce outside of the codebase. I'm going to have to add you to my (internal) diff and you only have to change from bluebird to promise to start reproing
from promise.
It turns out this is (as you suspected) caused by asap sometimes calling back twice and sometimes not at all. The offending issue is kriskowal/asap#55, which has now been resolved. Updating asap should be sufficient, which should happen automatically if you delete any caches and re-install.
I will release an update of promise that requires the latest version of asap though to encourage people to update faster.
from promise.
Related Issues (20)
- Promise do not change to "resolve" mode when calling the function again. HOT 4
- can Promise.resolve replace by code like this? HOT 2
- Add an additional method HOT 3
- promise pending HOT 1
- Discuss ways to avoid `new Function` in denodeify HOT 1
- Why promise. then is faster than setTimeout HOT 1
- who can tell me that what is the meaning of the code? HOT 2
- promise.race() missing from the API description in README HOT 4
- Promise.race resolves the combined Promise multiple times, which emits an error/warning event in node HOT 1
- Questions regarding unhandled rejections HOT 4
- Difference with native Promise HOT 2
- Promise.prototype.finally is not aligned with the most current spec draft HOT 1
- if (fn === noop) return; Can't judge correctly HOT 1
- Catch works earlier if I pass reject as second callback HOT 1
- code refactor. use new.target to detect if promise is called with new instead of this check HOT 1
- How can I build a setimmediate flavor that is not uglified? HOT 1
- optifine bugs HOT 1
- It's difference between native and shim HOT 1
- Promise.allSettled ? HOT 2
- [BUG]Why this promise execute queue is not same with v8 Promise。 HOT 1
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 promise.