@stacktrace-lite/core
    Preparing search index...

    Function installNodeErrorHooks

    • Install global Node.js handlers for uncaughtException and unhandledRejection.

      Parameters

      • options: NodeHookOptions = {}

        Configuration for filtering, formatting, and handling stacks.

      Returns void

      void

      • uncaughtException fires when an exception bubbles to the event loop without being caught. Registering a listener overrides Node’s default behavior (printing the stack and exiting with code 1). Handle with care. :contentReference[oaicite:0]{index=0}
      • unhandledRejection fires when a Promise rejects without a handler in the same turn of the event loop. Useful for detecting missing .catch() chains. :contentReference[oaicite:1]{index=1}

      Operational guidance

      • For uncaughtException, many production guides recommend logging, attempting minimal cleanup, and then letting the process crash or exiting—don’t try to continue in an unknown state. Use a supervisor (e.g., systemd/PM2) to restart. :contentReference[oaicite:2]{index=2}
      • For deep debugging of promise issues, node --trace-warnings can reveal unhandled rejection origins. :contentReference[oaicite:3]{index=3}
      installNodeErrorHooks({
      filter: { preset: 'app-only', include: [/^/app//] },
      format: 'cli',
      onStack(frames, err) {
      console.error('FATAL:', err.message);
      sendToCollector({ frames, err });
      // Optionally schedule a graceful shutdown:
      // setImmediate(() => process.exit(1));
      },
      });