Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: pkg/watcher/lib/src/directory_watcher.dart

Issue 23085006: Fix error handling in watcher. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cancel subscription after error too. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/watcher/lib/src/directory_watcher.dart
diff --git a/pkg/watcher/lib/src/directory_watcher.dart b/pkg/watcher/lib/src/directory_watcher.dart
index eb948f57cd5da7bb63884e1bbc63f74375f67eb4..16a5cf1c502d329041b25dca26ecefeb8254beca 100644
--- a/pkg/watcher/lib/src/directory_watcher.dart
+++ b/pkg/watcher/lib/src/directory_watcher.dart
@@ -134,18 +134,17 @@ class DirectoryWatcher {
if (entity is! File) return;
_filesToProcess.add(entity.path);
}, onError: (error) {
- if (isDirectoryNotFoundException(error)) {
- // If the directory doesn't exist, we end the listing normally, which
- // has the desired effect of marking all files that were in the
- // directory as being removed.
- endListing();
- return;
+ if (!isDirectoryNotFoundException(error)) {
+ // It's some unknown error. Pipe it over to the event stream so the
+ // user can see it.
+ _events.addError(error);
}
- // It's some unknown error. Pipe it over to the event stream so we don't
- // take down the whole isolate.
- _events.addError(error);
- }, onDone: endListing);
+ // When an error occurs, we end the listing normally, which has the
+ // desired effect of marking all files that were in the directory as
+ // being removed.
+ endListing();
+ }, onDone: endListing, cancelOnError: true);
}
/// Processes [file] to determine if it has been modified since the last
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698