Skip to content

Commit 7d1998d

Browse files
jyameoCommit Queue
authored andcommitted
catch error when connection is disposed
Change-Id: I7a6512091786701621ce5d1197f975eb3fb098c0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/438760 Reviewed-by: Ben Konyi <[email protected]> Auto-Submit: Jessy Yameogo <[email protected]> Commit-Queue: Jessy Yameogo <[email protected]>
1 parent 2b5d262 commit 7d1998d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pkg/vm_service/test/should_pause_on_exit_test.dart

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,19 @@ final tests = <IsolateTest>[
3838
expect(await shouldPauseOnExit(service, isolateRef), true);
3939
await service.resume(isolateRef.id!);
4040
await completer.future;
41-
await service.resume(isolateRef.id!);
41+
try {
42+
await service.resume(isolateRef.id!);
43+
} on RPCError catch (e) {
44+
// The server may have already shut down, causing the service connection
45+
// to be disposed before the resume response is sent.
46+
if (![
47+
RPCErrorKind.kConnectionDisposed.code,
48+
RPCErrorKind.kServerError.code,
49+
].contains(e.code)) {
50+
rethrow;
51+
}
52+
// This is expected - ignore it.
53+
}
4254
await subscription.cancel();
4355
},
4456
];

0 commit comments

Comments
 (0)