Log unhandled errors and promise rejections in the desktop app
Test code:
setTimeout(() => testFunctionSync(), 5000);
setTimeout(
() => testFunction().then(() => console.log("done testFunction")),
10000,
);
const testFunctionSync = () => {
console.log("sleeping not");
throw new Error("Handle me");
};
const testFunction = async () => {
console.log("sleeping");
await fs.mkdir("/tmp/foo", { recursive: true });
console.log("woke up");
throw new Error("Handle me");
};