Repository navigation
Commit e5036e6
committed
fix: guard per-watcher error emit with listenerCount (#46)
EventEmitter throws "Unhandled error" when "error" is emitted on a
Watcher with no handler attached. The previous commit unconditionally
emitted on every subscribed Watcher, which broke existing tests
(test/DirectoryWatcher.test.js "should log errors emitted from watcher
to stderr") that exercise onWatcherError without subscribing.
Mirror the listenerCount guard already in Watchpack._onError so the
emit is a no-op when nothing is listening; the existing console.error
fallback still surfaces the error.
https://claude.ai/code/session_0146XgwrLMQwsLYN4WuT2c9n1 parent ead223e commit e5036e6
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
697 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
698 | 701 | | |
699 | 702 | | |
700 | | - | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
701 | 706 | | |
702 | 707 | | |
703 | 708 | | |
| |||
0 commit comments