refactor: error handling

Meant to push this before release.
Ensures errors are handled as before, regardless of using exports
or lib/mysql; for compatibility.
This commit is contained in:
Linden committed 2022-06-18 16:32:07 +10:00
1 parent a709f67e99
commit 15884fbc82
4 files changed
+7 -7

No files matched your search

+2 -2
View File
@@ -30,7 +30,7 @@ export const rawQuery = async (
}).catch((err) => {
const error = `${invokingResource} was unable to execute a query!\n${err.message}\n${`${query} ${JSON.stringify(parameters)}`}`
if (cb && !throwError) cb(null, error);
if (throwError || !cb) throw new Error(error);
if (cb && throwError) return cb(null, error);
throw new Error(error);
});
};