diff --git a/client/homebrew/pages/errorPage/errors/errorIndex.js b/client/homebrew/pages/errorPage/errors/errorIndex.js index c0220b648..89abd570f 100644 --- a/client/homebrew/pages/errorPage/errors/errorIndex.js +++ b/client/homebrew/pages/errorPage/errors/errorIndex.js @@ -196,6 +196,12 @@ const errorIndex = (props)=>{ **Brew ID:** ${props.brew.brewId}`, + // Database Connection Lost + '13' : dedent` + ## Database connection has been lost. + + The server could not communicate with the database.`, + //account page when account is not defined '50' : dedent` ## You are not signed in diff --git a/server/middleware/dbCheck.js b/server/middleware/dbCheck.js index e90190517..154ab4a9c 100644 --- a/server/middleware/dbCheck.js +++ b/server/middleware/dbCheck.js @@ -6,8 +6,10 @@ export default (req, res, next)=>{ if(config.get('node_env') == 'test') return next(); if(mongoose.connection.readyState == 1) return next(); - return res.status(503).send({ - message : 'Unable to connect to database', - state : mongoose.connection.readyState - }); + throw { + HBErrorCode : 13, + name : 'Database Connection Error', + message : 'Unable to connect to database', + status : mongoose.connection.readyState + }; };