From d24fe93a709cb13731395828be2eea7ee973b39c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 22 Aug 2026 14:25:03 +0000 Subject: [PATCH 1/2] test: verify generic exception handling in MKMapViewController Add unit test to cover non-PlatformException handling in MKMapViewControllerImpl._enqueue. Co-authored-by: esenmx <43244505+esenmx@users.noreply.github.com> --- test/mk_map_view_controller_test.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/mk_map_view_controller_test.dart b/test/mk_map_view_controller_test.dart index d107450..0c771d7 100644 --- a/test/mk_map_view_controller_test.dart +++ b/test/mk_map_view_controller_test.dart @@ -266,6 +266,22 @@ void main() { ).has((e) => e.code, 'code').equals('boom'); }); + test( + 'non-platform exception completes error with original exception', + () async { + final exception = Exception('custom host error'); + harness.host.errorToThrow = exception; + + Object? caughtError; + try { + await harness.controller.setCamera(sampleCamera); + } on Object catch (e) { + caughtError = e; + } + check(caughtError).equals(exception); + }, + ); + test('queued calls after a failure still run', () async { harness.host.errorToThrow = PlatformException(code: 'boom'); final failing = harness.controller.setCamera(sampleCamera); From 2c80dc2bb628d8165df98803fc80ef2ebdd43c1f Mon Sep 17 00:00:00 2001 From: Mehmet Esen Date: Sun, 23 Aug 2026 16:59:04 +0300 Subject: [PATCH 2/2] test: assert stack trace survives non-PlatformException path Capture the StackTrace alongside the error so the test fails if `_enqueue` drops `st` when re-throwing a generic exception; switch `equals` to `identicalTo` to state the real invariant (same object, not `_Exception` equality). Co-Authored-By: Claude Fable 5 --- test/mk_map_view_controller_test.dart | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/mk_map_view_controller_test.dart b/test/mk_map_view_controller_test.dart index 0c771d7..f47cd14 100644 --- a/test/mk_map_view_controller_test.dart +++ b/test/mk_map_view_controller_test.dart @@ -266,21 +266,21 @@ void main() { ).has((e) => e.code, 'code').equals('boom'); }); - test( - 'non-platform exception completes error with original exception', - () async { - final exception = Exception('custom host error'); - harness.host.errorToThrow = exception; - - Object? caughtError; - try { - await harness.controller.setCamera(sampleCamera); - } on Object catch (e) { - caughtError = e; - } - check(caughtError).equals(exception); - }, - ); + test('non-platform error propagates unwrapped', () async { + final exception = Exception('custom host error'); + harness.host.errorToThrow = exception; + + Object? caughtError; + StackTrace? caughtTrace; + try { + await harness.controller.setCamera(sampleCamera); + } on Object catch (e, st) { + caughtError = e; + caughtTrace = st; + } + check(caughtError).identicalTo(exception); + check(caughtTrace.toString()).contains('FakeHostApi._record'); + }); test('queued calls after a failure still run', () async { harness.host.errorToThrow = PlatformException(code: 'boom');