Catch-all server-side HTML route errors
This commit is contained in:
parent
45d6a8e6e5
commit
e98d589683
@ -86,7 +86,13 @@ function frontendRoute(req, res) {
|
|||||||
data.user = user;
|
data.user = user;
|
||||||
data.building = building;
|
data.building = building;
|
||||||
renderHTML(context, data, req, res)
|
renderHTML(context, data, req, res)
|
||||||
})
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
data.user = undefined;
|
||||||
|
data.building = undefined;
|
||||||
|
contex.status = 500;
|
||||||
|
renderHTML(context, data, req, res);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderHTML(context, data, req, res){
|
function renderHTML(context, data, req, res){
|
||||||
@ -177,6 +183,7 @@ server.route('/building/:building_id.json')
|
|||||||
res.status(404).send({error:'Not Found'})
|
res.status(404).send({error:'Not Found'})
|
||||||
}
|
}
|
||||||
}).catch(function(error){
|
}).catch(function(error){
|
||||||
|
console.error(error);
|
||||||
res.send({error:'Database error'})
|
res.send({error:'Database error'})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user