[observatory] Fix nullable catch paramter issues

`NULLABLE_TYPE_IN_CATCH_CLAUSE` is becoming a warning, so these must be
fixed (or ignored).

TEST=presubmit

Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I8343f3e1f49ed3c05dcf2d99a98cef8a953afc7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280563
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Sam Rawlins 2023-02-03 17:32:27 +00:00 committed by Commit Queue
parent 9fb7ec56f9
commit 4495ccf80d
4 changed files with 11 additions and 8 deletions

View file

@ -219,9 +219,9 @@ class DownCommand extends DebuggerCommand {
try {
debugger.downFrame(count);
debugger.console.print('frame = ${debugger.currentFrame}');
} on dynamic catch (e) {
debugger.console
.print('frame must be in range [${e.start}..${e.end - 1}]');
} catch (e) {
debugger.console.print(
'frame must be in range [${(e as dynamic).start}..${(e as dynamic).end - 1}]');
}
return new Future.value(null);
}

View file

@ -27,7 +27,7 @@ testMain() async {
print('mmmmm'); // LINE_C.
try {
await helper(); // LINE_D.
} on dynamic catch (e) {
} catch (e) {
// arrive here on error.
print('error: $e'); // LINE_E.
} finally {

View file

@ -63,9 +63,12 @@ var tests = <IsolateTest>[
// Breakpoints are not allowed to set on non-debuggable libraries.
try {
await isolate.addBreakpoint(script, LINE_B);
} on dynamic catch (e) {
expect(e is ServerRpcException, true);
expect(e.code == ServerRpcException.kCannotAddBreakpoint, true);
} catch (e) {
expect(
e,
isA<ServerRpcException>().having((e) => e.code, 'code',
equals(ServerRpcException.kCannotAddBreakpoint)),
);
print("Set Breakpoint to non-debuggable library is not allowed");
}
},

View file

@ -23,7 +23,7 @@ collect() async {
try {
vmService = new VMServiceClient(uri);
await new Future.microtask(() => throw new TimeoutException("here"));
} on dynamic {
} on Object {
vmService.close();
rethrow; // LINE_A
}