Update modules/database.js
This commit is contained in:
+11
-9
@@ -59,20 +59,22 @@ async function runDDL() {
|
||||
|
||||
if (sql.trim()) {
|
||||
logger.log(`Execution of ${file.bold || file}`, ["DDL", "yellow"])
|
||||
await ddlConn.query(sql)
|
||||
try {
|
||||
await ddlConn.query(sql)
|
||||
} catch (error) {
|
||||
if (error?.fatal) {
|
||||
logger.error(`Critical error during execution of ${file}: ` + error.message, ["MariaDB", "yellow"])
|
||||
throw error
|
||||
}
|
||||
logger.warn(`Minimal error in ${file} (skipped): ` + error.message, ["MariaDB", "yellow"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.log("MariaDB database successfully initialised!", ["MariaDB", "yellow"])
|
||||
} catch (error) {
|
||||
if (error?.fatal) {
|
||||
logger.error("Critical error during DB initialisation: " + error.message, ["MariaDB", "yellow"])
|
||||
logger.error(error)
|
||||
throw error
|
||||
} else {
|
||||
logger.warn("Minimal error during DB initialisation: " + error.message, ["MariaDB", "yellow"])
|
||||
}
|
||||
|
||||
logger.error("DB initialisation aborted: " + error.message, ["MariaDB", "yellow"])
|
||||
throw error
|
||||
} finally {
|
||||
if (rootConn) {
|
||||
await rootConn.end()
|
||||
|
||||
Reference in New Issue
Block a user