| 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);
|
| },
|
| ];
|
|
|
|
|