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

Unified Diff: utils/pub/source_registry.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/source.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/source_registry.dart
diff --git a/utils/pub/source_registry.dart b/utils/pub/source_registry.dart
index 6bbcec234bccbc719dc61e40cde4fe3acdd94ec4..a963e1dab2ef1c82ad4aba9cb4ec92329f31621e 100644
--- a/utils/pub/source_registry.dart
+++ b/utils/pub/source_registry.dart
@@ -21,8 +21,7 @@ class SourceRegistry {
/// registered source.
void setDefault(String name) {
if (!_map.containsKey(name)) {
- // TODO(nweiz): Real error-handling system
- throw 'Default source $name is not in the registry';
+ throw new StateError('Default source $name is not in the registry');
}
_default = _map[name];
@@ -32,8 +31,8 @@ class SourceRegistry {
/// that's already been registered.
void register(Source source) {
if (_map.containsKey(source.name)) {
- // TODO(nweiz): Real error-handling system
- throw 'Source registry already has a source named ${source.name}';
+ throw new StateError('Source registry already has a source named '
+ '${source.name}');
}
_map[source.name] = source;
@@ -47,10 +46,9 @@ class SourceRegistry {
Source operator[](String name) {
if (name == null) {
if (defaultSource != null) return defaultSource;
- // TODO(nweiz): Real error-handling system
- throw 'No default source has been registered';
+ throw new StateError('No default source has been registered');
}
if (_map.containsKey(name)) return _map[name];
- throw 'No source named $name is registered';
+ throw new ArgumentError('No source named $name is registered');
}
}
« no previous file with comments | « utils/pub/source.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698