mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
05c3f459ad
commit
0de49e2a75
@ -43,10 +43,16 @@ module.exports = {
|
|||||||
rejectHandler: function(req,res,err) {
|
rejectHandler: function(req,res,err) {
|
||||||
//TODO: why this when errorHandler also?!
|
//TODO: why this when errorHandler also?!
|
||||||
log.audit({event: "api.error",error:err.code||"unexpected_error",message:err.message||err.toString()},req);
|
log.audit({event: "api.error",error:err.code||"unexpected_error",message:err.message||err.toString()},req);
|
||||||
res.status(err.status||400).json({
|
var response = {
|
||||||
code: err.code||"unexpected_error",
|
code: err.code||"unexpected_error",
|
||||||
message: err.message||err.toString()
|
message: err.message||err.toString()
|
||||||
});
|
};
|
||||||
|
// Handle auth failures on a specific remote
|
||||||
|
// TODO: don't hardcode this here - allow users of rejectHandler to identify extra props to send
|
||||||
|
if (err.remote) {
|
||||||
|
response.remote = err.remote;
|
||||||
|
}
|
||||||
|
res.status(err.status||400).json(response);
|
||||||
},
|
},
|
||||||
getRequestLogObject: function(req) {
|
getRequestLogObject: function(req) {
|
||||||
return {
|
return {
|
||||||
|
@ -706,7 +706,9 @@ Project.prototype.fetch = function(user,remoteName) {
|
|||||||
promise = promise.then(function() {
|
promise = promise.then(function() {
|
||||||
return gitTools.fetch(project.path,remote,authCache.get(project.name,project.remotes[remote].fetch,username))
|
return gitTools.fetch(project.path,remote,authCache.get(project.name,project.remotes[remote].fetch,username))
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
err.remote = remote;
|
if (!err.remote) {
|
||||||
|
err.remote = remote;
|
||||||
|
}
|
||||||
throw err;
|
throw err;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user