Index: pkg/compiler/lib/src/apiimpl.dart |
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart |
index a2c7d8c9a957ded550c1991ec264f4199629e78d..3352ac1b616d0acdfed746a4b655d43bdc769037 100644 |
--- a/pkg/compiler/lib/src/apiimpl.dart |
+++ b/pkg/compiler/lib/src/apiimpl.dart |
@@ -394,13 +394,22 @@ class Compiler extends leg.Compiler { |
} |
// The input provider may put a trailing 0 byte when it reads a source |
// file, which confuses the package config parser. |
- if (packageConfigContents.length > 0 |
- && packageConfigContents.last == 0) { |
+ if (packageConfigContents.length > 0 && |
+ packageConfigContents.last == 0) { |
packageConfigContents = packageConfigContents.sublist( |
0, packageConfigContents.length - 1); |
} |
- packages = |
- new MapPackages(pkgs.parse(packageConfigContents, packageConfig)); |
+ try { |
+ packages = |
+ new MapPackages(pkgs.parse(packageConfigContents, packageConfig)); |
+ } on FormatException catch (e) { |
Siggi Cherem (dart-lang)
2015/08/19 22:39:39
since the error messages are the same, do we actua
Harry Terkelsen
2015/08/19 22:56:30
Done.
|
+ reportError(NO_LOCATION_SPANNABLE, MessageKind.INVALID_PACKAGE_CONFIG, |
Siggi Cherem (dart-lang)
2015/08/19 22:39:39
not a big priority, but it would be interesting to
Harry Terkelsen
2015/08/19 22:56:30
Filed a FR with package_config: https://github.com
|
+ {'uri': packageConfig, 'exception': e}); |
+ packages = Packages.noPackages; |
+ } |
+ }).catchError((error) { |
+ reportError(NO_LOCATION_SPANNABLE, MessageKind.INVALID_PACKAGE_CONFIG, |
+ {'uri': packageConfig, 'exception': error}); |
Siggi Cherem (dart-lang)
2015/08/19 22:39:39
also add `packages = Packages.noPackages`?
Harry Terkelsen
2015/08/19 22:56:30
Done.
|
}); |
} else { |
if (packagesDiscoveryProvider == null) { |