mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
fix: don't throw errors outside of promises
This commit is contained in:
1 parent
c97a07a377
commit
1829ded03c
3 files changed
+20
-20
No files matched your search
@@ -12,7 +12,7 @@ export const rawExecute = (
|
||||
query: string,
|
||||
parameters: CFXParameters,
|
||||
cb?: CFXCallback,
|
||||
throwError?: boolean,
|
||||
isPromise?: boolean,
|
||||
unpack?: boolean
|
||||
) => {
|
||||
if (typeof query !== 'string')
|
||||
@@ -104,7 +104,7 @@ export const rawExecute = (
|
||||
resource: invokingResource,
|
||||
});
|
||||
|
||||
if (cb && throwError) return cb(null, error);
|
||||
throw new Error(error);
|
||||
if (cb && isPromise) return cb(null, error);
|
||||
console.error(error);
|
||||
});
|
||||
};
|
||||
@@ -12,7 +12,7 @@ export const rawQuery = (
|
||||
query: string,
|
||||
parameters: CFXParameters,
|
||||
cb?: CFXCallback,
|
||||
throwError?: boolean
|
||||
isPromise?: boolean
|
||||
) => {
|
||||
if (typeof query !== 'string')
|
||||
throw new Error(
|
||||
@@ -56,7 +56,7 @@ export const rawQuery = (
|
||||
resource: invokingResource,
|
||||
});
|
||||
|
||||
if (cb && throwError) return cb(null, error);
|
||||
throw new Error(error);
|
||||
if (cb && isPromise) return cb(null, error);
|
||||
console.error(error);
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user