@@ -91,9 +91,11 @@ export abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
9191 const response = fetchWithProgress ( ) ;
9292
9393 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 ) {
9799 this . logger . log ( {
98100 timestamp : new Date ( ) ,
99101 level : LogLevel . ERROR ,
@@ -102,8 +104,9 @@ export abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
102104 event : LogEvent . ERROR ,
103105 value : 'Failed to instantiate WASM: ' + error ,
104106 } ) ;
107+
105108 throw new Error ( error ) ;
106- } ) ;
109+ }
107110 } ;
108111
109112 initiateStreaming ( ) ;
@@ -113,9 +116,11 @@ export abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
113116 const request = new Request ( this . mainModuleURL ) ;
114117
115118 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 ) {
119124 this . logger . log ( {
120125 timestamp : new Date ( ) ,
121126 level : LogLevel . ERROR ,
@@ -124,8 +129,9 @@ export abstract class DuckDBBrowserBindings extends DuckDBBindingsBase {
124129 event : LogEvent . ERROR ,
125130 value : 'Failed to instantiate WASM: ' + error ,
126131 } ) ;
132+
127133 throw new Error ( error ) ;
128- } ) ;
134+ }
129135 } ;
130136
131137 initiateStreaming ( ) ;
0 commit comments