mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 22:20:56 +00:00
fix(query): less verbose errors
This commit is contained in:
1 parent
defe3afb75
commit
c9e402ccdc
4 files changed
+13
-14
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ game 'common'
|
|||||||
|
|
||||||
name 'oxmysql'
|
name 'oxmysql'
|
||||||
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
description 'Database wrapper for FiveM utilising node-mysql2 offering improved performance and security.'
|
||||||
version '2.2.1'
|
version '2.2.2'
|
||||||
url 'https://github.com/overextended/oxmysql'
|
url 'https://github.com/overextended/oxmysql'
|
||||||
author 'overextended'
|
author 'overextended'
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "oxmysql",
|
"name": "oxmysql",
|
||||||
"version": "2.2.1",
|
"version": "2.2.2",
|
||||||
"description": "FXServer to MySQL communication via node-mysql2",
|
"description": "FXServer to MySQL communication via node-mysql2",
|
||||||
"repository": "[email protected]:overextended/oxmysql.git",
|
"repository": "[email protected]:overextended/oxmysql.git",
|
||||||
"author": "dunak-debug <[email protected]>",
|
"author": "dunak-debug <[email protected]>",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ let serverReady = false;
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
pool = createPool({
|
pool = createPool({
|
||||||
connectTimeout: 60000,
|
connectTimeout: 60000,
|
||||||
|
trace: false,
|
||||||
...connectionOptions,
|
...connectionOptions,
|
||||||
typeCast,
|
typeCast,
|
||||||
});
|
});
|
||||||
|
|||||||
+10
-12
@@ -16,18 +16,16 @@ export const rawQuery = async (
|
|||||||
await scheduleTick();
|
await scheduleTick();
|
||||||
[query, parameters, cb] = parseArguments(invokingResource, query, parameters, cb);
|
[query, parameters, cb] = parseArguments(invokingResource, query, parameters, cb);
|
||||||
|
|
||||||
//@ts-ignore TODO: patch mysql2 type
|
return await new Promise((resolve, reject) => {
|
||||||
pool.query(query, parameters, (err, result, _, executionTime) => {
|
pool.query(query, parameters, (err, result, _, executionTime) => {
|
||||||
logQuery(invokingResource, query, executionTime, parameters);
|
if (err) return reject(err);
|
||||||
if (err)
|
|
||||||
throw new Error(
|
|
||||||
`${invokingResource} was unable to execute a query!\n${err.message}\n${`${query} ${JSON.stringify(
|
|
||||||
parameters
|
|
||||||
)}`}`
|
|
||||||
);
|
|
||||||
|
|
||||||
if (cb) {
|
logQuery(invokingResource, query, executionTime, parameters);
|
||||||
cb(parseResponse(type, result));
|
resolve(cb ? cb(parseResponse(type, result)) : null);
|
||||||
}
|
});
|
||||||
|
}).catch((err) => {
|
||||||
|
throw new Error(
|
||||||
|
`${invokingResource} was unable to execute a query!\n${err.message}\n${`${query} ${JSON.stringify(parameters)}`}`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user