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

Unified Diff: lib/src/barback/web_socket_api.dart

Issue 2256623003: Fix more strong mode errors and warnings. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 4 years, 4 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 | « lib/src/barback/transformer_id.dart ('k') | lib/src/command/build.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/barback/web_socket_api.dart
diff --git a/lib/src/barback/web_socket_api.dart b/lib/src/barback/web_socket_api.dart
index b0a502edc1f438493a4378da9f9fbb1c47677bb0..a911dfc6d57e5d94d414b7f49bcf0363402f946c 100644
--- a/lib/src/barback/web_socket_api.dart
+++ b/lib/src/barback/web_socket_api.dart
@@ -221,15 +221,14 @@ class WebSocketApi {
/// }
///
/// If the directory is already being served, returns the previous URL.
- Future<Map> _serveDirectory(json_rpc.Parameters params) {
+ Future<Map> _serveDirectory(json_rpc.Parameters params) async {
var rootDirectory = _validateRelativePath(params, "path");
- return _environment.serveDirectory(rootDirectory).then((server) {
+ try {
+ var server = await _environment.serveDirectory(rootDirectory);
return {
"url": server.url.toString()
};
- }).catchError((error) {
- if (error is! OverlappingSourceDirectoryException) throw error;
-
+ } on OverlappingSourceDirectoryException catch (error) {
var dir = pluralize("directory", error.overlappingDirectories.length,
plural: "directories");
var overlapping = toSentence(error.overlappingDirectories.map(
@@ -240,7 +239,7 @@ class WebSocketApi {
data: {
"directories": error.overlappingDirectories
});
- });
+ }
}
/// Given a relative directory path within the entrypoint package, unbinds
« no previous file with comments | « lib/src/barback/transformer_id.dart ('k') | lib/src/command/build.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698