mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Project ui code using incorrect error property
This commit is contained in:
parent
0ec04a3624
commit
81ae552e69
@ -79,7 +79,6 @@ function CommsConnection(ws) {
|
|||||||
addActiveConnection(self);
|
addActiveConnection(self);
|
||||||
}
|
}
|
||||||
ws.on('close',function() {
|
ws.on('close',function() {
|
||||||
console.log(arguments);
|
|
||||||
log.audit({event: "comms.close",user:self.user, session: self.session});
|
log.audit({event: "comms.close",user:self.user, session: self.session});
|
||||||
log.trace("comms.close "+self.session);
|
log.trace("comms.close "+self.session);
|
||||||
removeActiveConnection(self);
|
removeActiveConnection(self);
|
||||||
|
@ -43,7 +43,7 @@ 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||500).json({
|
res.status(err.status||400).json({
|
||||||
code: err.code||"unexpected_error",
|
code: err.code||"unexpected_error",
|
||||||
message: err.message||err.toString()
|
message: err.message||err.toString()
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,7 @@ RED.projects = (function() {
|
|||||||
var activeProject;
|
var activeProject;
|
||||||
function reportUnexpectedError(error) {
|
function reportUnexpectedError(error) {
|
||||||
var notification;
|
var notification;
|
||||||
if (error.error === 'git_missing_user') {
|
if (error.code === 'git_missing_user') {
|
||||||
notification = RED.notify("<p>"+RED._("projects.errors.no-username-email")+"</p>",{
|
notification = RED.notify("<p>"+RED._("projects.errors.no-username-email")+"</p>",{
|
||||||
fixed: true,
|
fixed: true,
|
||||||
type:'error',
|
type:'error',
|
||||||
@ -43,7 +43,7 @@ RED.projects = (function() {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
notification = RED.notify("<p>"+RED._("projects.errors.unexpected")+":</p><p>"+error.message+"</p><small>"+RED._("projects.errors.code")+": "+error.error+"</small>",{
|
notification = RED.notify("<p>"+RED._("projects.errors.unexpected")+":</p><p>"+error.message+"</p><small>"+RED._("projects.errors.code")+": "+error.code+"</small>",{
|
||||||
fixed: true,
|
fixed: true,
|
||||||
modal: true,
|
modal: true,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
@ -1507,7 +1507,7 @@ RED.projects = (function() {
|
|||||||
return switchProject(selectedProject.name,function(err,data) {
|
return switchProject(selectedProject.name,function(err,data) {
|
||||||
dialog.dialog( "close" );
|
dialog.dialog( "close" );
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.error !== 'credentials_load_failed') {
|
if (err.code !== 'credentials_load_failed') {
|
||||||
console.log(RED._("projects.create.unexpected_error"),err)
|
console.log(RED._("projects.create.unexpected_error"),err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1893,7 +1893,6 @@ RED.projects = (function() {
|
|||||||
function sendRequest(options,body) {
|
function sendRequest(options,body) {
|
||||||
// dialogBody.hide();
|
// dialogBody.hide();
|
||||||
// console.log(options.url,body);
|
// console.log(options.url,body);
|
||||||
|
|
||||||
if (options.requireCleanWorkspace && RED.nodes.dirty()) {
|
if (options.requireCleanWorkspace && RED.nodes.dirty()) {
|
||||||
var thenCallback;
|
var thenCallback;
|
||||||
var alwaysCallback;
|
var alwaysCallback;
|
||||||
@ -1952,7 +1951,7 @@ RED.projects = (function() {
|
|||||||
resultCallback = responses;
|
resultCallback = responses;
|
||||||
resultCallbackArgs = {error:responses.statusText};
|
resultCallbackArgs = {error:responses.statusText};
|
||||||
return;
|
return;
|
||||||
} else if (options.handleAuthFail !== false && xhr.responseJSON.error === 'git_auth_failed') {
|
} else if (options.handleAuthFail !== false && xhr.responseJSON.code === 'git_auth_failed') {
|
||||||
var url = activeProject.git.remotes[xhr.responseJSON.remote||options.remote||'origin'].fetch;
|
var url = activeProject.git.remotes[xhr.responseJSON.remote||options.remote||'origin'].fetch;
|
||||||
|
|
||||||
var message = $('<div>'+
|
var message = $('<div>'+
|
||||||
@ -2040,8 +2039,8 @@ RED.projects = (function() {
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (responses[xhr.responseJSON.error]) {
|
} else if (responses[xhr.responseJSON.code]) {
|
||||||
resultCallback = responses[xhr.responseJSON.error];
|
resultCallback = responses[xhr.responseJSON.code];
|
||||||
resultCallbackArgs = xhr.responseJSON;
|
resultCallbackArgs = xhr.responseJSON;
|
||||||
return;
|
return;
|
||||||
} else if (responses['*']) {
|
} else if (responses['*']) {
|
||||||
@ -2050,10 +2049,12 @@ RED.projects = (function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(responses)
|
||||||
console.log(RED._("projects.send-req.unhandled")+":");
|
console.log(RED._("projects.send-req.unhandled")+":");
|
||||||
console.log(xhr);
|
console.log(xhr);
|
||||||
console.log(textStatus);
|
console.log(textStatus);
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
console.log(stack);
|
||||||
}).always(function() {
|
}).always(function() {
|
||||||
var delta = Date.now() - start;
|
var delta = Date.now() - start;
|
||||||
delta = Math.max(0,500-delta);
|
delta = Math.max(0,500-delta);
|
||||||
|
@ -74,7 +74,7 @@ describe('api/editor/credentials', function() {
|
|||||||
request(app)
|
request(app)
|
||||||
.get("/credentials/unknown-type/n2")
|
.get("/credentials/unknown-type/n2")
|
||||||
.expect("Content-Type",/json/)
|
.expect("Content-Type",/json/)
|
||||||
.expect(500)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
done(err);
|
done(err);
|
||||||
|
@ -102,7 +102,7 @@ describe("api/editor/sshkeys", function() {
|
|||||||
mockRuntime.settings.getUserKeys.returns(p);
|
mockRuntime.settings.getUserKeys.returns(p);
|
||||||
request(app)
|
request(app)
|
||||||
.get("/settings/user/keys")
|
.get("/settings/user/keys")
|
||||||
.expect(500)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
@ -139,7 +139,7 @@ describe("api/editor/sshkeys", function() {
|
|||||||
mockRuntime.settings.getUserKeys.returns(p)
|
mockRuntime.settings.getUserKeys.returns(p)
|
||||||
request(app)
|
request(app)
|
||||||
.get("/settings/user/keys")
|
.get("/settings/user/keys")
|
||||||
.expect(500)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
@ -179,7 +179,7 @@ describe("api/editor/sshkeys", function() {
|
|||||||
mockRuntime.settings.getUserKey.returns(p);
|
mockRuntime.settings.getUserKey.returns(p);
|
||||||
request(app)
|
request(app)
|
||||||
.get("/settings/user/keys/" + key_file_name)
|
.get("/settings/user/keys/" + key_file_name)
|
||||||
.expect(500)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
@ -200,7 +200,7 @@ describe("api/editor/sshkeys", function() {
|
|||||||
mockRuntime.settings.getUserKey.returns(p);
|
mockRuntime.settings.getUserKey.returns(p);
|
||||||
request(app)
|
request(app)
|
||||||
.get("/settings/user/keys/" + key_file_name)
|
.get("/settings/user/keys/" + key_file_name)
|
||||||
.expect(500)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
@ -238,7 +238,7 @@ describe("api/editor/sshkeys", function() {
|
|||||||
request(app)
|
request(app)
|
||||||
.post("/settings/user/keys")
|
.post("/settings/user/keys")
|
||||||
.send({ name: key_file_name })
|
.send({ name: key_file_name })
|
||||||
.expect(500)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
@ -260,7 +260,7 @@ describe("api/editor/sshkeys", function() {
|
|||||||
request(app)
|
request(app)
|
||||||
.post("/settings/user/keys")
|
.post("/settings/user/keys")
|
||||||
.send({ name: key_file_name })
|
.send({ name: key_file_name })
|
||||||
.expect(500)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
@ -297,7 +297,7 @@ describe("api/editor/sshkeys", function() {
|
|||||||
mockRuntime.settings.removeUserKey.returns(p);
|
mockRuntime.settings.removeUserKey.returns(p);
|
||||||
request(app)
|
request(app)
|
||||||
.delete("/settings/user/keys/" + key_file_name)
|
.delete("/settings/user/keys/" + key_file_name)
|
||||||
.expect(500)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
@ -318,7 +318,7 @@ describe("api/editor/sshkeys", function() {
|
|||||||
mockRuntime.settings.removeUserKey.returns(p);
|
mockRuntime.settings.removeUserKey.returns(p);
|
||||||
request(app)
|
request(app)
|
||||||
.delete("/settings/user/keys/" + key_file_name)
|
.delete("/settings/user/keys/" + key_file_name)
|
||||||
.expect(500)
|
.expect(400)
|
||||||
.end(function(err,res) {
|
.end(function(err,res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
|
Loading…
Reference in New Issue
Block a user