This commit is contained in:
Benjamin Toby
2025-04-23 14:40:16 +01:00
parent daad62141e
commit e7b7cf0314
3 changed files with 18 additions and 1 deletions
@@ -42,6 +42,7 @@ export default async function connDbHandler<ReturnType = any>(
label: "res",
});
}
return JSON.parse(JSON.stringify(res));
} else if (typeof query == "object") {
const resArray = [];
@@ -86,6 +87,15 @@ export default async function connDbHandler<ReturnType = any>(
}
} catch (error: any) {
global.ERROR_CALLBACK?.(`Connection DB Handler Error`, error as Error);
if (debug) {
debugLog({
log: `Connection DB Handler Error: ${error.message}`,
addTime: true,
label: "Error",
});
}
return null;
} finally {
conn?.end();