Closed ChoSeoHwan closed 9 months ago
Everything that happens after the promise is resolved (when the microtask fires) happens synchronously in nested functions, and is no different than if you were to do something like:
(async () => {
await delay(1000)
console.log(new Error().stack);
})()
Or more accurately:
const delay = (timeout) => new Promise((resolve) => {
setTimeout(resolve, timeout);
});
(async function mergeMapNext() {
await delay(1000);
rxjsLogic();
})();
function rxjsLogic() {
tapNext();
}
function tapNext() {
innerTapNext();
}
function innerTapNext() {
userProvidedFunction();
}
function userProvidedFunction() {
console.log(new Error().stack);
}
That said, I couldn't replicate the issue myself: https://replit.com/@benlesh/rxjs-issue-7442#index.js
And I also tried cloning your repository and checking on the same version of node. I couldn't reproduce the issue.
I would recommend that you look up "why is my stack trace missing in node?" because it seems to be a condition of errors being thrown after promise resolution in specific versions of node? Although I tried the same one and could reproduce the bug.
Regardless, this doesn't seem to have anything to do with RxJS, because we can't really control the call stack produced by new Error().stack
.
Describe the bug
Lost stacktrace after promise is resolved.
Expected behavior
Expect
Stacktrace must be maintained after promise is resolved.
Reproduction code
Reproduction URL
https://github.com/ChoSeoHwan/rxjs-bug-report-0
Version
7.8.1
Environment
Additional context
No response