diff --git a/.github/workflows/e2e_windows.yaml b/.github/workflows/e2e_windows.yaml index de1c66627b..7e1ac99734 100644 --- a/.github/workflows/e2e_windows.yaml +++ b/.github/workflows/e2e_windows.yaml @@ -63,7 +63,7 @@ jobs: timeout-minutes: 60 run: | flutter config --enable-windows-desktop - dart pub global run aft exec --include=${{ inputs.package-name }} -- flutter test integration_test/main_test.dart -d windows + dart pub global run aft exec --include=${{ inputs.package-name }} -- flutter test integration_test/main_test.dart -d windows --timeout=120 - name: Log success/failure if: always() diff --git a/packages/common/amplify_db_common/example/integration_test/main_test.dart b/packages/common/amplify_db_common/example/integration_test/main_test.dart index 503076b63d..f98fabd390 100644 --- a/packages/common/amplify_db_common/example/integration_test/main_test.dart +++ b/packages/common/amplify_db_common/example/integration_test/main_test.dart @@ -23,11 +23,13 @@ void main() { }); testWidgets('can decrement', (_) async { + print('Running "can decrement" test'); expect(await db.getLatestCount(), 0); await Future.wait([ for (var i = 0; i < 10; i++) db.decrementCount(), ]); expect(await db.getLatestCount(), -10); + print('"can decrement" test passed'); }); testWidgets('can increment', (_) async { diff --git a/packages/common/amplify_db_common_dart/lib/src/connect_io.dart b/packages/common/amplify_db_common_dart/lib/src/connect_io.dart index 5d65aee014..c8dbc998b0 100644 --- a/packages/common/amplify_db_common_dart/lib/src/connect_io.dart +++ b/packages/common/amplify_db_common_dart/lib/src/connect_io.dart @@ -33,7 +33,16 @@ QueryExecutor connect({ _IsolateStartRequest(receiveDriftIsolate.sendPort, dbPath), ); - final driftIsolate = await receiveDriftIsolate.first as DriftIsolate; + final driftIsolateOrError = await receiveDriftIsolate.first; + + if (driftIsolateOrError is Map && + driftIsolateOrError.containsKey('error')) { + throw Exception( + 'Error in isolate: ${driftIsolateOrError['message']}}', + ); + } + + final driftIsolate = driftIsolateOrError as DriftIsolate; return driftIsolate.connect(); }), ).executor; @@ -47,11 +56,15 @@ class _IsolateStartRequest { } void _entrypointForDriftIsolate(_IsolateStartRequest request) { - final databaseImpl = NativeDatabase(File(request.databasePath)); + try { + final databaseImpl = NativeDatabase(File(request.databasePath)); - final driftServer = DriftIsolate.inCurrent( - () => DatabaseConnection(databaseImpl), - ); + final driftServer = DriftIsolate.inCurrent( + () => DatabaseConnection(databaseImpl), + ); - request.talkToMain.send(driftServer); + request.talkToMain.send(driftServer); + } catch (e, stack) { + request.talkToMain.send({'error': e.toString(), 'stack': stack.toString()}); + } }