Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: utils/pub/pubspec.dart

Issue 14253005: Migrate pub away from throwing strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/pub.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library pubspec; 5 library pubspec;
6 6
7 import 'package:yaml/yaml.dart'; 7 import 'package:yaml/yaml.dart';
8 import 'package:pathos/path.dart' as path; 8 import 'package:pathos/path.dart' as path;
9 9
10 import 'io.dart'; 10 import 'io.dart';
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 if (pubspec.name == null) { 47 if (pubspec.name == null) {
48 throw new PubspecHasNoNameException(name); 48 throw new PubspecHasNoNameException(name);
49 } 49 }
50 50
51 if (name != null && pubspec.name != name) { 51 if (name != null && pubspec.name != name) {
52 throw new PubspecNameMismatchException(name, pubspec.name); 52 throw new PubspecNameMismatchException(name, pubspec.name);
53 } 53 }
54 54
55 return pubspec; 55 return pubspec;
56 } on FormatException catch (ex) { 56 } on FormatException catch (ex) {
57 throw 'Could not parse $pubspecPath:\n${ex.message}'; 57 fail('Could not parse $pubspecPath:\n${ex.message}');
58 } 58 }
59 } 59 }
60 60
61 Pubspec(this.name, this.version, this.dependencies, this.devDependencies, 61 Pubspec(this.name, this.version, this.dependencies, this.devDependencies,
62 this.environment, [Map<String, Object> fields]) 62 this.environment, [Map<String, Object> fields])
63 : this.fields = fields == null ? {} : fields; 63 : this.fields = fields == null ? {} : fields;
64 64
65 Pubspec.empty() 65 Pubspec.empty()
66 : name = null, 66 : name = null,
67 version = Version.none, 67 version = Version.none,
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 /// The environment-related metadata in the pubspec. Corresponds to the data 293 /// The environment-related metadata in the pubspec. Corresponds to the data
294 /// under the "environment:" key in the pubspec. 294 /// under the "environment:" key in the pubspec.
295 class PubspecEnvironment { 295 class PubspecEnvironment {
296 /// The version constraint specifying which SDK versions this package works 296 /// The version constraint specifying which SDK versions this package works
297 /// with. 297 /// with.
298 final VersionConstraint sdkVersion; 298 final VersionConstraint sdkVersion;
299 299
300 PubspecEnvironment([VersionConstraint sdk]) 300 PubspecEnvironment([VersionConstraint sdk])
301 : sdkVersion = sdk != null ? sdk : VersionConstraint.any; 301 : sdkVersion = sdk != null ? sdk : VersionConstraint.any;
302 } 302 }
OLDNEW
« no previous file with comments | « utils/pub/pub.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698