Skip to content

Commit

Permalink
JavaScript catches to always be logged in console, also in node
Browse files Browse the repository at this point in the history
  • Loading branch information
carlopi committed Jul 18, 2023
1 parent 4a12fe5 commit 6e71b61
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/duckdb-wasm/src/bindings/runtime_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
NODE_RUNTIME._fileInfoCache.set(fileId, info);
return info as DuckDBFileInfo;
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
return null;
}
Expand Down Expand Up @@ -95,6 +96,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
failWith(mod, 'Unsupported data protocol');
}
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
}
return 0;
Expand All @@ -120,6 +122,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
break;
}
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
}
return 0;
Expand All @@ -139,6 +142,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
failWith(mod, 'Unsupported data protocol');
}
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
}
return 0;
Expand All @@ -162,6 +166,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
failWith(mod, 'Unsupported data protocol');
}
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
}
return 0;
Expand All @@ -186,6 +191,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
failWith(mod, 'Unsupported data protocol');
}
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
}
return 0;
Expand All @@ -209,6 +215,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
failWith(mod, 'Unsupported data protocol');
}
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
}
return 0;
Expand All @@ -219,6 +226,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
const path = decodeText(mod.HEAPU8.subarray(pathPtr, pathPtr + pathLen));
return fs.existsSync(path);
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
return false;
}
Expand All @@ -228,6 +236,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
const path = decodeText(mod.HEAPU8.subarray(pathPtr, pathPtr + pathLen));
return fs.mkdirSync(path);
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
return 0;
}
Expand All @@ -237,6 +246,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
const path = decodeText(mod.HEAPU8.subarray(pathPtr, pathPtr + pathLen));
return fs.rmdirSync(path);
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
return 0;
}
Expand All @@ -253,6 +263,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
mod.ccall('duckdb_web_fs_glob_add_path', null, ['string'], [entry]);
}
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
return 0;
}
Expand All @@ -278,6 +289,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
const path = decodeText(mod.HEAPU8.subarray(pathPtr, pathPtr + pathLen));
return fs.existsSync(path);
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
return false;
}
Expand All @@ -287,6 +299,7 @@ export const NODE_RUNTIME: DuckDBRuntime & {
const path = decodeText(mod.HEAPU8.subarray(pathPtr, pathPtr + pathLen));
return fs.rmSync(path);
} catch (e: any) {
console.log(e);
failWith(mod, e.toString());
return 0;
}
Expand Down

0 comments on commit 6e71b61

Please sign in to comment.