mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 14:42:40 +00:00
Change error result to use Error Page
This commit is contained in:
@@ -196,6 +196,12 @@ const errorIndex = (props)=>{
|
|||||||
|
|
||||||
**Brew ID:** ${props.brew.brewId}`,
|
**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
|
//account page when account is not defined
|
||||||
'50' : dedent`
|
'50' : dedent`
|
||||||
## You are not signed in
|
## You are not signed in
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ export default (req, res, next)=>{
|
|||||||
if(config.get('node_env') == 'test') return next();
|
if(config.get('node_env') == 'test') return next();
|
||||||
|
|
||||||
if(mongoose.connection.readyState == 1) return next();
|
if(mongoose.connection.readyState == 1) return next();
|
||||||
return res.status(503).send({
|
throw {
|
||||||
message : 'Unable to connect to database',
|
HBErrorCode : 13,
|
||||||
state : mongoose.connection.readyState
|
name : 'Database Connection Error',
|
||||||
});
|
message : 'Unable to connect to database',
|
||||||
|
status : mongoose.connection.readyState
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user