Index: utils/pub/package.dart |
diff --git a/utils/pub/package.dart b/utils/pub/package.dart |
index 00eaf842fef7f15947f318d5520dabd073b84c41..8d84546ec8f676209b7164ce815c5293b948ff88 100644 |
--- a/utils/pub/package.dart |
+++ b/utils/pub/package.dart |
@@ -27,12 +27,17 @@ class Package { |
if (!exists) throw new PubspecNotFoundException(name); |
return readTextFile(pubspecPath); |
}).transform((contents) { |
- var pubspec = new Pubspec.parse(contents, sources); |
- if (pubspec.name == null) throw new PubspecHasNoNameException(name); |
- if (name != null && pubspec.name != name) { |
- throw new PubspecNameMismatchException(name, pubspec.name); |
+ try { |
+ var pubspec = new Pubspec.parse(contents, sources); |
+ |
+ if (pubspec.name == null) throw new PubspecHasNoNameException(name); |
+ if (name != null && pubspec.name != name) { |
+ throw new PubspecNameMismatchException(name, pubspec.name); |
+ } |
+ return new Package._(packageDir, pubspec); |
+ } on FormatException catch (ex) { |
+ throw 'Could not parse $pubspecPath:\n${ex.message}'; |
} |
- return new Package._(packageDir, pubspec); |
}); |
} |