Better error handling/reporting in project creation

This commit is contained in:
Nick O'Leary
2018-02-05 15:59:11 +00:00
parent 9f7dd7f5d4
commit 5fe5db603d
6 changed files with 79 additions and 54 deletions

View File

@@ -248,8 +248,11 @@ module.exports = {
res.redirect(303,req.baseUrl+"/"+projectName+"/status");
})
.catch(function(err) {
console.log(err.stack);
res.status(400).json({error:"unexpected_error", message:err.toString()});
if (err.code) {
res.status(400).json({error:err.code, message: err.message});
} else {
res.status(400).json({error:"unexpected_error", message:err.toString()});
}
})
});