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

Unified Diff: pkg/scheduled_test/lib/scheduled_server.dart

Issue 23591061: Make package:scheduled_test throw ScheduledServerErrors, not strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix formatting and stray code. Created 7 years, 3 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
Index: pkg/scheduled_test/lib/scheduled_server.dart
diff --git a/pkg/scheduled_test/lib/scheduled_server.dart b/pkg/scheduled_test/lib/scheduled_server.dart
index 8c1ad815da2ef4894087c5fcc9b38ad32212e655..b5983e42576032d022db143fca933592b1d92ce4 100644
--- a/pkg/scheduled_test/lib/scheduled_server.dart
+++ b/pkg/scheduled_test/lib/scheduled_server.dart
@@ -91,8 +91,9 @@ class ScheduledServer {
void _handleRequest(HttpRequest request) {
wrapFuture(new Future.sync(() {
if (_handlers.isEmpty) {
- throw "'$description' received ${request.method} ${request.uri.path} "
- "when no more requests were expected.";
+ throw new ScheduledServerError(
+ "'$description' received ${request.method} ${request.uri.path} "
+ "when no more requests were expected.");
}
return _handlers.removeFirst().fn(request);
}).catchError((e) {
@@ -102,3 +103,12 @@ class ScheduledServer {
}), 'receiving ${request.method} ${request.uri}');
}
}
+
+
+class ScheduledServerError extends Error {
nweiz 2013/09/19 19:56:14 I'm not a fan of using a custom error class here.
Bill Hesse 2013/09/20 13:30:20 Done.
+ final String message;
+
+ ScheduledServerError(String this.message);
+
+ String toString() => 'ScheduledServerError: $message';
+}

Powered by Google App Engine
This is Rietveld 408576698