MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / isWatchResourceExhaustion

Function isWatchResourceExhaustion

src/sync/watcher.ts:101–108  ·  view source on GitHub ↗

* True when an error is OS watch/file-descriptor exhaustion (EMFILE/ENFILE). * Prefers the structured `err.code`; falls back to message matching ONLY when * no code is present (some platforms surface a bare Error from `fs.watch`).

(err: unknown)

Source from the content-addressed store, hash-verified

99 * no code is present (some platforms surface a bare Error from `fs.watch`).
100 */
101function isWatchResourceExhaustion(err: unknown): boolean {
102 const e = err as NodeJS.ErrnoException | undefined;
103 if (e?.code === 'EMFILE' || e?.code === 'ENFILE') return true;
104 if (!e?.code && e?.message) {
105 return /EMFILE|ENFILE|too many open files/i.test(e.message);
106 }
107 return false;
108}
109
110/**
111 * True when an error is Linux inotify *watch-count* exhaustion. `fs.watch`

Callers 3

startMethod · 0.85
startRecursiveMethod · 0.85
watchTreeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected