mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-25 21:15:55 +00:00
fix: handle empty result set by rejecting with an error on mysql query
This commit is contained in:
parent
0348d04b0e
commit
0817515b10
1 changed files with 5 additions and 1 deletions
|
@ -421,7 +421,11 @@ exports.mysqlQuery = function (connectionString, query, password = undefined) {
|
|||
reject(err);
|
||||
} else {
|
||||
if (Array.isArray(res)) {
|
||||
resolve("Rows: " + res.length);
|
||||
if (res.length === 0) {
|
||||
reject(new Error("No rows returned"));
|
||||
} else {
|
||||
resolve("Rows: " + res.length);
|
||||
}
|
||||
} else {
|
||||
resolve("No Error, but the result is not an array. Type: " + typeof res);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue