When passing a promise to pTimeout that rejects, error.stack
ends at p-timeout/index.js:92:13
Example 1:
import pTimeout from "p-timeout";
import { setTimeout } from "node:timers/promises";
const a = async () => {
await setTimeout(1);
throw new Error("oops");
};
const b = async () => {
await pTimeout(a(), { milliseconds: 500 });
};
try {
await b();
} catch (error) {
console.log(error.stack);
}
Example 1 output:
Error: oops
at a (file:///tmp/index.js:6:9)
at async file:///tmp/node_modules/p-timeout/index.js:92:13
Example 2:
import { setTimeout } from "node:timers/promises";
const a = async () => {
await setTimeout(1);
throw new Error("oops");
};
const b = async () => {
await a();
};
try {
await b();
} catch (error) {
console.log(error.stack);
}
Example 2 output:
Error: oops
at a (file:///tmp/index.js:6:9)
at async b (file:///tmp/indexjs:10:3)
at async file:///tmp/index.js:14:3
In Example 1, these parts are missing from error.stack
:
at async b (file:///tmp/index.js:10:3)
at async file:///tmp/index.js:14:3
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too