mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-02 08:35:07 +08:00
- Preserve fields, accessors, added properties, and cyclic references across untyped class boundaries. - Support platform signal names and native exception handlers that resume queued work.
21 lines
908 B
JavaScript
21 lines
908 B
JavaScript
let count = 0;
|
|
const late = (error) => console.log("late", error.message);
|
|
const removed = (error) => console.log("snapshot", error.message);
|
|
const handler = (error, origin) => {
|
|
console.log("handled", error.message, origin);
|
|
process.off("uncaughtException", removed);
|
|
if (count === 1) process.once("uncaughtException", late);
|
|
process.nextTick(() => console.log("tick", count));
|
|
};
|
|
process.on("uncaughtException", handler);
|
|
process.on("uncaughtException", removed);
|
|
process.once("uncaughtExceptionMonitor", (error, origin) => console.log("monitor", error.message, origin));
|
|
const interval = setInterval(() => {
|
|
count++;
|
|
if (count < 3) throw new Error("interval " + count);
|
|
clearInterval(interval);
|
|
process.off("uncaughtException", handler);
|
|
process.once("uncaughtException", (value, origin) => console.log("primitive", value, origin));
|
|
setImmediate(() => { throw "immediate"; });
|
|
}, 10);
|