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

Unified Diff: lib/src/runner/browser/safari.dart

Issue 1091883002: More gracefully handle browser errors. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: merge Created 5 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 | « lib/src/runner/browser/phantom_js.dart ('k') | lib/src/runner/browser/server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/browser/safari.dart
diff --git a/lib/src/runner/browser/safari.dart b/lib/src/runner/browser/safari.dart
index 4ad28da4a41180fb1df9a2cbf837930e18fa4728..af697850b282d954d87c23a39554a494d9a3d664 100644
--- a/lib/src/runner/browser/safari.dart
+++ b/lib/src/runner/browser/safari.dart
@@ -9,8 +9,11 @@ import 'dart:convert';
import 'dart:io';
import 'package:path/path.dart' as p;
+import 'package:stack_trace/stack_trace.dart';
import '../../util/io.dart';
+import '../../utils.dart';
+import '../application_exception.dart';
import 'browser.dart';
/// A class for running an instance of Safari.
@@ -59,9 +62,19 @@ class Safari implements Browser {
return _process.exitCode;
});
}).then((exitCode) {
- if (exitCode != 0) throw "Safari failed with exit code $exitCode.";
- }).then(_onExitCompleter.complete)
- .catchError(_onExitCompleter.completeError);
+ if (exitCode == 0) return null;
+
+ return UTF8.decodeStream(_process.stderr).then((error) {
+ throw new ApplicationException(
+ "Safari failed with exit code $exitCode:\n$error");
+ });
+ }).then(_onExitCompleter.complete).catchError((error, stackTrace) {
+ if (stackTrace == null) stackTrace = new Trace.current();
+ _onExitCompleter.completeError(
+ new ApplicationException(
+ "Failed to start Safari: ${getErrorMessage(error)}."),
+ stackTrace);
+ });
}
Future close() {
« no previous file with comments | « lib/src/runner/browser/phantom_js.dart ('k') | lib/src/runner/browser/server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698