Skip to content

Commit a479f91

Browse files
eyebrowsoffireCommit Queue
authored and
Commit Queue
committed
Throw an RPC error when calling methods on a disposed connection.
This is consistent with the way we handle outstanding requests when the service is disposed. Note that some of the devtools code in flutter expects and handles this RPC error in some cases. Change-Id: I56aae14f898b6d62b77d10ef50dec63ae96d507d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367821 Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Jackson Gardner <[email protected]>
1 parent 429f3e1 commit a479f91

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/vm_service/lib/src/vm_service.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,6 +1769,13 @@ class VmService {
17691769
}
17701770

17711771
Future<T> _call<T>(String method, [Map args = const {}]) {
1772+
if (_disposed) {
1773+
throw RPCError(
1774+
method,
1775+
RPCErrorKind.kServerError.code,
1776+
'Service connection disposed',
1777+
);
1778+
}
17721779
return wrapFuture<T>(
17731780
method,
17741781
() {

0 commit comments

Comments
 (0)