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

Unified Diff: runtime/observatory/tests/service/malformed_test.dart

Issue 1120133002: Rework error handling in the service protocol and in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix tests Created 5 years, 7 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: runtime/observatory/tests/service/malformed_test.dart
diff --git a/runtime/observatory/tests/service/malformed_test.dart b/runtime/observatory/tests/service/malformed_test.dart
index b5f86dd5c4c753a18f978009a3a7800a56829169..3d22471925b3c75fba9ecddae5abc7170eb4a5e3 100644
--- a/runtime/observatory/tests/service/malformed_test.dart
+++ b/runtime/observatory/tests/service/malformed_test.dart
@@ -9,23 +9,31 @@ import 'test_helper.dart';
var tests = [
(Isolate isolate) async {
- await isolate.invokeRpc('_respondWithMalformedObject', {}).then((result) {
+ bool caughtException;
+ try {
+ await isolate.invokeRpc('_respondWithMalformedObject', {});
expect(false, isTrue, reason:'Unreachable');
- }).catchError((ServiceException exception) {
- expect(exception.kind, equals('ResponseFormatException'));
- expect(exception.message,
- startsWith("Response is missing the 'type' field"));
- });
+ } on MalformedResponseRpcException catch (e) {
+ caughtException = true;
+ expect(e.message, equals("Response is missing the 'type' field"));
+ }
+ expect(caughtException, isTrue);
},
// Do this test last... it kills the vm connection.
(Isolate isolate) async {
- await isolate.invokeRpc('_respondWithMalformedJson', {}).then((result) {
+ bool caughtException;
+ try {
+ await isolate.invokeRpc('_respondWithMalformedJson', {});
expect(false, isTrue, reason:'Unreachable');
- }).catchError((ServiceException exception) {
- expect(exception.kind, equals('ConnectionClosed'));
- expect(exception.message, startsWith('Error decoding JSON message'));
- });
+ } on NetworkRpcException catch (e) {
+ caughtException = true;
+ expect(e.message,
+ startsWith("Canceling request: "
+ "Connection saw corrupt JSON message: "
+ "FormatException: Unexpected character"));
+ }
+ expect(caughtException, isTrue);
},
];

Powered by Google App Engine
This is Rietveld 408576698