Skip to content

Commit 644b283

Browse files
Ignore expected exceptions from the navigateToCode extension method. (#9266)
1 parent 8afcde1 commit 644b283

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

packages/devtools_app_shared/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Copyright 2025 The Flutter Authors
33
Use of this source code is governed by a BSD-style license that can be
44
found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
55
-->
6+
## 0.4.1 (not released)
7+
* Ignore expected exceptions from the `navigateToCode` extension method.
8+
69
## 0.4.0
710
* Bump `dtd` dependency to `^4.0.0`.
811
* Bump `devtools_shared` dependency to `^12.0.0`.

packages/devtools_app_shared/lib/src/service/service_utils.dart

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,22 @@ extension VmServiceExtension on VmService {
6363
required int column,
6464
required String source,
6565
}) async {
66-
await postEvent('ToolEvent', 'navigate', <String, Object>{
67-
'fileUri': fileUriString,
68-
'line': line,
69-
'column': column,
70-
'source': source,
71-
});
66+
try {
67+
await postEvent('ToolEvent', 'navigate', <String, Object>{
68+
'fileUri': fileUriString,
69+
'line': line,
70+
'column': column,
71+
'source': source,
72+
});
73+
} on RPCError catch (e) {
74+
// An [RPCErrorKind.kCustomStreamDoesNotExist] error is expected if the
75+
// custom 'ToolEvent' stream does not have any listeners (i.e. there are
76+
// no IDEs listening to this stream).
77+
if (e.code == RPCErrorKind.kCustomStreamDoesNotExist.code) {
78+
return;
79+
}
80+
rethrow;
81+
}
7282
}
7383
}
7484

packages/devtools_app_shared/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
44
name: devtools_app_shared
55
description: Package of Dart & Flutter structures shared between devtools_app and devtools extensions.
6-
version: 0.4.0
6+
version: 0.4.1
77
repository: https://github.com/flutter/devtools/tree/master/packages/devtools_app_shared
88

99
environment:

0 commit comments

Comments
 (0)