Skip to content

Commit 7f4ae76

Browse files
parth bagdacarlopi
authored andcommitted
added a check to insure worker is runing or not
1 parent b1453c5 commit 7f4ae76

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/duckdb-wasm/src/bindings/connection.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ export class DuckDBConnection {
4646
resolve(this._bindings.pollPendingQuery(this._conn));
4747
} catch (e: any) {
4848
console.log(e);
49-
reject(e);
49+
// If the worker is not set, the worker has been terminated
50+
if (e.message.includes('worker is not set!')) {
51+
reject(new Error('Worker has been terminated'));
52+
} else {
53+
//Otherwise, reject with the error
54+
reject(e);
55+
}
56+
5057
}
5158
});
5259
}

0 commit comments

Comments
 (0)