From 8ae1d930b29cb905cddec4d8eadbb69a88773301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20F=C3=B6rster?= Date: Tue, 13 Feb 2024 07:50:10 +0100 Subject: [PATCH] handle and pass on exception for async scope initialization --- injectable/lib/src/get_it_helper.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/injectable/lib/src/get_it_helper.dart b/injectable/lib/src/get_it_helper.dart index 4929fb7..be2f765 100644 --- a/injectable/lib/src/get_it_helper.dart +++ b/injectable/lib/src/get_it_helper.dart @@ -265,8 +265,12 @@ class GetItHelper { getIt.pushNewScope( scopeName: name, init: (getIt) async { - await init(this); - completer.complete(getIt); + try { + await init(this); + completer.complete(getIt); + } catch (e, s) { + completer.completeError(e, s); + } }, dispose: dispose, );