Commit 1bae8a03 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Print error message if a package is skipped during DevFS sync. (#8960)

* Print error message if a package is skipped during DevFS sync.

* review comments

* more review comments

* fix test
parent e01e4c18
...@@ -490,10 +490,13 @@ class DevFS { ...@@ -490,10 +490,13 @@ class DevFS {
await for (FileSystemEntity file in files) { await for (FileSystemEntity file in files) {
if (!devFSConfig.noDirectorySymlinks && (file is Link)) { if (!devFSConfig.noDirectorySymlinks && (file is Link)) {
// Check if this is a symlink to a directory and skip it. // Check if this is a symlink to a directory and skip it.
final String linkPath = file.resolveSymbolicLinksSync(); try {
final FileSystemEntityType linkType = final FileSystemEntityType linkType =
fs.statSync(linkPath).type; fs.statSync(file.resolveSymbolicLinksSync()).type;
if (linkType == FileSystemEntityType.DIRECTORY) { if (linkType == FileSystemEntityType.DIRECTORY)
continue;
} on FileSystemException catch (e) {
_printScanDirectoryError(file.path, e);
continue; continue;
} }
} }
...@@ -521,13 +524,21 @@ class DevFS { ...@@ -521,13 +524,21 @@ class DevFS {
if (!_shouldIgnore(deviceUri)) if (!_shouldIgnore(deviceUri))
_scanFile(deviceUri, file); _scanFile(deviceUri, file);
} }
} catch (e) { } on FileSystemException catch (e) {
// Ignore directory and error. _printScanDirectoryError(directory.path, e);
return false; return false;
} }
return true; return true;
} }
void _printScanDirectoryError(String path, Exception e) {
printError(
'Error while scanning $path.\n'
'Hot Reload might not work until the following error is resolved:\n'
'$e\n'
);
}
Future<Null> _scanPackages(Set<String> fileFilter) async { Future<Null> _scanPackages(Set<String> fileFilter) async {
StringBuffer sb; StringBuffer sb;
final PackageMap packageMap = new PackageMap(_packagesFilePath); final PackageMap packageMap = new PackageMap(_packagesFilePath);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment