Merge pull request #252 from yaredtsy/bugfix/undefined_nodeClass

[server] check `nodeModule.nodeClass` is not undefined before trying to intialize
This commit is contained in:
Henry Heng
2023-06-06 10:17:56 +01:00
committed by GitHub
+2 -3
View File
@@ -19,7 +19,8 @@ export class NodesPool {
nodeFiles.map(async (file) => {
if (file.endsWith('.js')) {
const nodeModule = await require(file)
try {
if (nodeModule.nodeClass) {
const newNodeInstance = new nodeModule.nodeClass()
newNodeInstance.filePath = file
@@ -37,8 +38,6 @@ export class NodesPool {
const nodeIconAbsolutePath = `${filePath.join('/')}/${newNodeInstance.icon}`
this.componentNodes[newNodeInstance.name].icon = nodeIconAbsolutePath
}
} catch (e) {
// console.error(e);
}
}
})