node:domainis deprecated in Node. Prefer explicit Promise andEventEmittererror handling in new code.
Elide exports Domain, create(), createDomain(), and active. Basic
synchronous error routing works:
import domain from "node:domain";
const scope = domain.create();
scope.on("error", (error) => console.log(error.message));
scope.run(() => {
throw new Error("boom");
});
// boomThe class exposes run, bind, intercept, enter, exit, and the
EventEmitter surface. Compatibility for complex asynchronous domain flows is
not guaranteed.