Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/node-crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ export async function cryptoModule(): Promise<Crypto> {
try {
crypto = await import('node:crypto');
/* c8 ignore next 6 */
} catch (err) {
} catch (err: unknown) {
let error: Error;
if (err instanceof Error) {
error = err;
} else {
error = new Error(String(err));
}
throw new CloudSQLConnectorError({
message: 'Support to node crypto module is required',
code: 'ENOCRYPTOMODULE',
errors: [error],
});
}
return crypto;
Expand Down
Loading