Skip to content

Commit ea221ac

Browse files
authored
Update db-function.js
updated release error when db not connected
1 parent 14bf41b commit ea221ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

config/db-function.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function connectionCheck() {
55
return new Promise((resolve,reject) => {
66
db.getConnection(function(err, connection) {
77
if(err) {
8-
connection.release();
8+
if(connection) connection.release();
99
reject(err)
1010
} else {
1111
resolve('success')
@@ -23,4 +23,4 @@ function connectionRelease() {
2323
module.exports = {
2424
connectionCheck:connectionCheck(),
2525
connectionRelease:connectionRelease()
26-
}
26+
}

0 commit comments

Comments
 (0)