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);
|
||||
}
|
||||
ws.on('close',function() {
|
||||
console.log(arguments);
|
||||
log.audit({event: "comms.close",user:self.user, session: self.session});
|
||||
log.trace("comms.close "+self.session);
|
||||
removeActiveConnection(self);
|
||||
|
@ -43,7 +43,7 @@ module.exports = {
|
||||
rejectHandler: function(req,res,err) {
|
||||
//TODO: why this when errorHandler also?!
|
||||
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",
|
||||
message: err.message||err.toString()
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ RED.projects = (function() {
|
||||
var activeProject;
|
||||
function reportUnexpectedError(error) {
|
||||
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>",{
|
||||
fixed: true,
|
||||
type:'error',
|
||||
@ -43,7 +43,7 @@ RED.projects = (function() {
|
||||
})
|
||||
} else {
|
||||
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,
|
||||
modal: true,
|
||||
type: 'error',
|
||||
@ -1507,7 +1507,7 @@ RED.projects = (function() {
|
||||
return switchProject(selectedProject.name,function(err,data) {
|
||||
dialog.dialog( "close" );
|
||||
if (err) {
|
||||
if (err.error !== 'credentials_load_failed') {
|
||||
if (err.code !== 'credentials_load_failed') {
|
||||
console.log(RED._("projects.create.unexpected_error"),err)
|
||||
}
|
||||
}
|
||||
@ -1893,7 +1893,6 @@ RED.projects = (function() {
|
||||
function sendRequest(options,body) {
|
||||
// dialogBody.hide();
|
||||
// console.log(options.url,body);
|
||||
|
||||
if (options.requireCleanWorkspace && RED.nodes.dirty()) {
|
||||
var thenCallback;
|
||||
var alwaysCallback;
|
||||
@ -1952,7 +1951,7 @@ RED.projects = (function() {
|
||||
resultCallback = responses;
|
||||
resultCallbackArgs = {error:responses.statusText};
|
||||
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 message = $('<div>'+
|
||||
@ -2040,8 +2039,8 @@ RED.projects = (function() {
|
||||
]
|
||||
});
|
||||
return;
|
||||
} else if (responses[xhr.responseJSON.error]) {
|
||||
resultCallback = responses[xhr.responseJSON.error];
|
||||
} else if (responses[xhr.responseJSON.code]) {
|
||||
resultCallback = responses[xhr.responseJSON.code];
|
||||
resultCallbackArgs = xhr.responseJSON;
|
||||
return;
|
||||
} else if (responses['*']) {
|
||||
@ -2050,10 +2049,12 @@ RED.projects = (function() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log(responses)
|
||||
console.log(RED._("projects.send-req.unhandled")+":");
|
||||
console.log(xhr);
|
||||
console.log(textStatus);
|
||||
console.log(err);
|
||||
console.log(stack);
|
||||
}).always(function() {
|
||||
var delta = Date.now() - start;
|
||||
delta = Math.max(0,500-delta);
|
||||
|
@ -74,7 +74,7 @@ describe('api/editor/credentials', function() {
|
||||
request(app)
|
||||
.get("/credentials/unknown-type/n2")
|
||||
.expect("Content-Type",/json/)
|
||||
.expect(500)
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
done(err);
|
||||
|
@ -102,7 +102,7 @@ describe("api/editor/sshkeys", function() {
|
||||
mockRuntime.settings.getUserKeys.returns(p);
|
||||
request(app)
|
||||
.get("/settings/user/keys")
|
||||
.expect(500)
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -139,7 +139,7 @@ describe("api/editor/sshkeys", function() {
|
||||
mockRuntime.settings.getUserKeys.returns(p)
|
||||
request(app)
|
||||
.get("/settings/user/keys")
|
||||
.expect(500)
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -179,7 +179,7 @@ describe("api/editor/sshkeys", function() {
|
||||
mockRuntime.settings.getUserKey.returns(p);
|
||||
request(app)
|
||||
.get("/settings/user/keys/" + key_file_name)
|
||||
.expect(500)
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -200,7 +200,7 @@ describe("api/editor/sshkeys", function() {
|
||||
mockRuntime.settings.getUserKey.returns(p);
|
||||
request(app)
|
||||
.get("/settings/user/keys/" + key_file_name)
|
||||
.expect(500)
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -238,7 +238,7 @@ describe("api/editor/sshkeys", function() {
|
||||
request(app)
|
||||
.post("/settings/user/keys")
|
||||
.send({ name: key_file_name })
|
||||
.expect(500)
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -260,7 +260,7 @@ describe("api/editor/sshkeys", function() {
|
||||
request(app)
|
||||
.post("/settings/user/keys")
|
||||
.send({ name: key_file_name })
|
||||
.expect(500)
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -297,7 +297,7 @@ describe("api/editor/sshkeys", function() {
|
||||
mockRuntime.settings.removeUserKey.returns(p);
|
||||
request(app)
|
||||
.delete("/settings/user/keys/" + key_file_name)
|
||||
.expect(500)
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
@ -318,7 +318,7 @@ describe("api/editor/sshkeys", function() {
|
||||
mockRuntime.settings.removeUserKey.returns(p);
|
||||
request(app)
|
||||
.delete("/settings/user/keys/" + key_file_name)
|
||||
.expect(500)
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
|
Loading…
Reference in New Issue
Block a user