DirectoryWatcher: Small adjustments (#1112)

- Have the handler throw
- Log the failure at error level
This commit is contained in:
Danny Canter
2026-01-29 18:25:48 -08:00
committed by GitHub
parent 0a7fb07757
commit 3f2060e460
@@ -59,9 +59,9 @@ public class DirectoryWatcher {
do {
let files = try FileManager.default.contentsOfDirectory(atPath: directoryURL.path)
try? handler(files.map { directoryURL.appending(path: $0) })
try handler(files.map { directoryURL.appending(path: $0) })
} catch {
self.log.info("failed to run handler for \(directoryURL.path)")
self.log.error("failed to run DirectoryWatcher handler", metadata: ["error": "\(error)", "path": "\(directoryURL.path)"])
}
}