File tree 3 files changed +14
-6
lines changed 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -394,13 +394,17 @@ class Compiler extends leg.Compiler {
394
394
}
395
395
// The input provider may put a trailing 0 byte when it reads a source
396
396
// file, which confuses the package config parser.
397
- if (packageConfigContents.length > 0
398
- && packageConfigContents.last == 0 ) {
397
+ if (packageConfigContents.length > 0 &&
398
+ packageConfigContents.last == 0 ) {
399
399
packageConfigContents = packageConfigContents.sublist (
400
400
0 , packageConfigContents.length - 1 );
401
401
}
402
402
packages =
403
403
new MapPackages (pkgs.parse (packageConfigContents, packageConfig));
404
+ }).catchError ((error) {
405
+ reportError (NO_LOCATION_SPANNABLE , MessageKind .INVALID_PACKAGE_CONFIG ,
406
+ {'uri' : packageConfig, 'exception' : error});
407
+ packages = Packages .noPackages;
404
408
});
405
409
} else {
406
410
if (packagesDiscoveryProvider == null ) {
Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ enum MessageKind {
256
256
INVALID_OVERRIDE_METHOD ,
257
257
INVALID_OVERRIDE_SETTER ,
258
258
INVALID_OVERRIDE_SETTER_WITH_FIELD ,
259
+ INVALID_PACKAGE_CONFIG ,
259
260
INVALID_PACKAGE_URI ,
260
261
INVALID_PARAMETER ,
261
262
INVALID_RECEIVER_IN_INITIALIZER ,
@@ -2233,6 +2234,13 @@ import '../../Udyn[mic ils/expect.dart';
2233
2234
main() {}
2234
2235
""" ]),
2235
2236
2237
+ MessageKind .INVALID_PACKAGE_CONFIG :
2238
+ const MessageTemplate (MessageKind .INVALID_PACKAGE_CONFIG ,
2239
+ """Package config file '#{uri}' is invalid.
2240
+ #{exception}""" ,
2241
+ howToFix: DONT_KNOW_HOW_TO_FIX
2242
+ ),
2243
+
2236
2244
MessageKind .INVALID_PACKAGE_URI :
2237
2245
const MessageTemplate (MessageKind .INVALID_PACKAGE_URI ,
2238
2246
"'#{uri}' is not a valid package URI (#{exception})." ,
Original file line number Diff line number Diff line change @@ -100,10 +100,6 @@ javascript_compatibility_errors_test: Skip
100
100
javascript_compatibility_warnings_test: Skip
101
101
unboxed_int_converter_test: Skip
102
102
pair_location_remapping_test: Skip
103
- package/scenarios/invalid/non_existent_packages_file_test: Crash # Issue 24118
104
- package/scenarios/invalid/invalid_utf8_test: Crash # Issue 24120
105
- package/scenarios/invalid/invalid_package_name_test: Crash # Issue 24121
106
- package/scenarios/invalid/same_package_twice_test: Crash # Issue 24122
107
103
108
104
[ $compiler == dart2js && $jscl ]
109
105
assert_test: RuntimeError, OK # Assumes unspecified fields on the AssertionError.
You can’t perform that action at this time.
0 commit comments