From f9fbfda703a468f0cf6906e9a3c93bb9caf11d5d Mon Sep 17 00:00:00 2001 From: davidmorgan Date: Fri, 28 Nov 2025 10:07:27 +0100 Subject: [PATCH] Report out of watchers error from subdirectories. --- .../lib/src/directory_watcher/linux/watch_tree.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/watcher/lib/src/directory_watcher/linux/watch_tree.dart b/pkgs/watcher/lib/src/directory_watcher/linux/watch_tree.dart index f916611d8..763b31201 100644 --- a/pkgs/watcher/lib/src/directory_watcher/linux/watch_tree.dart +++ b/pkgs/watcher/lib/src/directory_watcher/linux/watch_tree.dart @@ -292,8 +292,15 @@ class WatchTree { _directories.remove(directory)?._emitDeleteTree(); _directories[directory] = WatchTree( emitEvent: _emitEvent, - // Ignore exceptions from subdirectories. - onError: (Object e, StackTrace s) {}, + onError: (Object e, StackTrace s) { + // Ignore exceptions from subdirectories except "out of watchers" + // which is an unrecoverable error. + if (e is FileSystemException && + e.message.contains('Failed to watch path') && + e.osError?.errorCode == 28) { + _onError(e, s); + } + }, watchedDirectoryWasDeleted: () { _emitDeleteDirectory(directory); },