@@ -91,9 +91,11 @@ export abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
91
91
const response = fetchWithProgress ( ) ;
92
92
93
93
const initiateStreaming = async ( ) => {
94
- await WebAssembly . instantiateStreaming ( response , imports ) . then ( output => {
95
- success ( output . instance , output . module ) ;
96
- } ) . catch ( error => {
94
+ try {
95
+ await WebAssembly . instantiateStreaming ( response , imports ) . then ( output => {
96
+ success ( output . instance , output . module ) ;
97
+ } ) ;
98
+ } catch ( error : any ) {
97
99
this . logger . log ( {
98
100
timestamp : new Date ( ) ,
99
101
level : LogLevel . ERROR ,
@@ -102,8 +104,9 @@ export abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
102
104
event : LogEvent . ERROR ,
103
105
value : 'Failed to instantiate WASM: ' + error ,
104
106
} ) ;
107
+
105
108
throw new Error ( error ) ;
106
- } ) ;
109
+ }
107
110
} ;
108
111
109
112
initiateStreaming ( ) ;
@@ -113,9 +116,11 @@ export abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
113
116
const request = new Request ( this . mainModuleURL ) ;
114
117
115
118
const initiateStreaming = async ( ) => {
116
- await WebAssembly . instantiateStreaming ( fetch ( request ) , imports ) . then ( output => {
117
- success ( output . instance , output . module ) ;
118
- } ) . catch ( error => {
119
+ try {
120
+ await WebAssembly . instantiateStreaming ( fetch ( request ) , imports ) . then ( output => {
121
+ success ( output . instance , output . module ) ;
122
+ } )
123
+ } catch ( error : any ) {
119
124
this . logger . log ( {
120
125
timestamp : new Date ( ) ,
121
126
level : LogLevel . ERROR ,
@@ -124,8 +129,9 @@ export abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
124
129
event : LogEvent . ERROR ,
125
130
value : 'Failed to instantiate WASM: ' + error ,
126
131
} ) ;
132
+
127
133
throw new Error ( error ) ;
128
- } ) ;
134
+ }
129
135
} ;
130
136
131
137
initiateStreaming ( ) ;
0 commit comments