File tree 2 files changed +14
-2
lines changed 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -381,13 +381,17 @@ class Compiler extends leg.Compiler {
381
381
}
382
382
// The input provider may put a trailing 0 byte when it reads a source
383
383
// file, which confuses the package config parser.
384
- if (packageConfigContents.length > 0
385
- && packageConfigContents.last == 0 ) {
384
+ if (packageConfigContents.length > 0 &&
385
+ packageConfigContents.last == 0 ) {
386
386
packageConfigContents = packageConfigContents.sublist (
387
387
0 , packageConfigContents.length - 1 );
388
388
}
389
389
packages =
390
390
new MapPackages (pkgs.parse (packageConfigContents, packageConfig));
391
+ }).catchError ((error) {
392
+ reportError (NO_LOCATION_SPANNABLE , MessageKind .INVALID_PACKAGE_CONFIG ,
393
+ {'uri' : packageConfig, 'exception' : error});
394
+ packages = Packages .noPackages;
391
395
});
392
396
} else {
393
397
if (packagesDiscoveryProvider == null ) {
Original file line number Diff line number Diff line change @@ -252,6 +252,7 @@ enum MessageKind {
252
252
INVALID_OVERRIDE_METHOD ,
253
253
INVALID_OVERRIDE_SETTER ,
254
254
INVALID_OVERRIDE_SETTER_WITH_FIELD ,
255
+ INVALID_PACKAGE_CONFIG ,
255
256
INVALID_PACKAGE_URI ,
256
257
INVALID_PARAMETER ,
257
258
INVALID_RECEIVER_IN_INITIALIZER ,
@@ -2224,6 +2225,13 @@ import '../../Udyn[mic ils/expect.dart';
2224
2225
main() {}
2225
2226
""" ]),
2226
2227
2228
+ MessageKind .INVALID_PACKAGE_CONFIG :
2229
+ const MessageTemplate (MessageKind .INVALID_PACKAGE_CONFIG ,
2230
+ """Package config file '#{uri}' is invalid.
2231
+ #{exception}""" ,
2232
+ howToFix: DONT_KNOW_HOW_TO_FIX
2233
+ ),
2234
+
2227
2235
MessageKind .INVALID_PACKAGE_URI :
2228
2236
const MessageTemplate (MessageKind .INVALID_PACKAGE_URI ,
2229
2237
"'#{uri}' is not a valid package URI (#{exception})." ,
You can’t perform that action at this time.
0 commit comments