mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Improve error reporting when installing bad nodes
This commit is contained in:
parent
ec27e19e3f
commit
29e903e1c8
@ -544,7 +544,8 @@
|
|||||||
"nodeEnabled_plural": "Nodes enabled:",
|
"nodeEnabled_plural": "Nodes enabled:",
|
||||||
"nodeDisabled": "Node disabled:",
|
"nodeDisabled": "Node disabled:",
|
||||||
"nodeDisabled_plural": "Nodes disabled:",
|
"nodeDisabled_plural": "Nodes disabled:",
|
||||||
"nodeUpgraded": "Node module __module__ upgraded to version __version__"
|
"nodeUpgraded": "Node module __module__ upgraded to version __version__",
|
||||||
|
"unknownNodeRegistered": "Unrecognised node type registered: <ul><li>__type__</li></ul>"
|
||||||
},
|
},
|
||||||
"editor": {
|
"editor": {
|
||||||
"title": "Manage palette",
|
"title": "Manage palette",
|
||||||
|
@ -142,9 +142,12 @@ RED.nodes = (function() {
|
|||||||
RED.events.emit("registry:node-set-disabled",ns);
|
RED.events.emit("registry:node-set-disabled",ns);
|
||||||
},
|
},
|
||||||
registerNodeType: function(nt,def) {
|
registerNodeType: function(nt,def) {
|
||||||
nodeDefinitions[nt] = def;
|
|
||||||
def.type = nt;
|
|
||||||
if (nt.substring(0,8) != "subflow:") {
|
if (nt.substring(0,8) != "subflow:") {
|
||||||
|
if (!nodeSets[typeToId[nt]]) {
|
||||||
|
var fullType = (RED._loadingModule?("["+RED._loadingModule+"] "):"")+nt
|
||||||
|
RED.notify(RED._("palette.event.unknownNodeRegistered",{type:fullType}), "error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
def.set = nodeSets[typeToId[nt]];
|
def.set = nodeSets[typeToId[nt]];
|
||||||
nodeSets[typeToId[nt]].added = true;
|
nodeSets[typeToId[nt]].added = true;
|
||||||
nodeSets[typeToId[nt]].enabled = true;
|
nodeSets[typeToId[nt]].enabled = true;
|
||||||
@ -167,9 +170,13 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: too tightly coupled into palette UI
|
// TODO: too tightly coupled into palette UI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def.type = nt;
|
||||||
|
nodeDefinitions[nt] = def;
|
||||||
|
|
||||||
|
|
||||||
if (def.defaults) {
|
if (def.defaults) {
|
||||||
for (var d in def.defaults) {
|
for (var d in def.defaults) {
|
||||||
if (def.defaults.hasOwnProperty(d)) {
|
if (def.defaults.hasOwnProperty(d)) {
|
||||||
|
@ -299,16 +299,29 @@ async function installModule(module,version,url) {
|
|||||||
|
|
||||||
function reportAddedModules(info) {
|
function reportAddedModules(info) {
|
||||||
if (info.nodes.length > 0) {
|
if (info.nodes.length > 0) {
|
||||||
log.info(log._("server.added-types"));
|
const installedTypes = [];
|
||||||
|
const errorSets = [];
|
||||||
for (var i=0;i<info.nodes.length;i++) {
|
for (var i=0;i<info.nodes.length;i++) {
|
||||||
for (var j=0;j<info.nodes[i].types.length;j++) {
|
const typeCount = info.nodes[i].types.length;
|
||||||
log.info(" - "+
|
if (typeCount > 0) {
|
||||||
(info.nodes[i].module?info.nodes[i].module+":":"")+
|
for (var j=0;j<typeCount;j++) {
|
||||||
info.nodes[i].types[j]+
|
installedTypes.push(" - "+
|
||||||
(info.nodes[i].err?" : "+info.nodes[i].err:"")
|
(info.nodes[i].module?info.nodes[i].module+":":"")+
|
||||||
);
|
info.nodes[i].types[j]+
|
||||||
|
(info.nodes[i].err?" : "+info.nodes[i].err:"")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (info.nodes[i].err) {
|
||||||
|
errorSets.push(`[${info.nodes[i].id}] ${info.nodes[i].err}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (errorSets.length > 0) {
|
||||||
|
errorSets.forEach(l => log.warn(l))
|
||||||
|
}
|
||||||
|
if (installedTypes.length > 0) {
|
||||||
|
log.info(log._("server.added-types"));
|
||||||
|
installedTypes.forEach(l => log.info(l))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user