Skip to content

Commit

Permalink
fix(hapi): solve unhandle db connection error (#706)
Browse files Browse the repository at this point in the history
Co-authored-by: Leister Alvarez Campos <[email protected]>
  • Loading branch information
leisterfrancisco and Leister Alvarez Campos authored Aug 26, 2021
1 parent 4df321c commit bb8cf34
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion hapi/src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
const massive = require('massive')

const massiveConfig = require('./server.config')
const massiveDB = (async () => await massive(massiveConfig))()
const massiveDB = (async () => {
try {
return await massive(massiveConfig)
} catch (err) {
console.log('---- Failed to connect to database ----')
console.log(err)

return null
}
})()

module.exports = {
massiveConfig,
Expand Down

0 comments on commit bb8cf34

Please sign in to comment.