Merge pull request #1786 from Jaredude/bug/nodespool-file-map-error-handling
handles scenario where NodesPool require call fails
This commit is contained in:
commit
2290ba9cc0
|
|
@ -4,6 +4,7 @@ import { Dirent } from 'fs'
|
|||
import { getNodeModulesPackagePath } from './utils'
|
||||
import { promises } from 'fs'
|
||||
import { ICommonObject } from 'flowise-components'
|
||||
import logger from './utils/logger'
|
||||
|
||||
export class NodesPool {
|
||||
componentNodes: IComponentNodes = {}
|
||||
|
|
@ -28,6 +29,7 @@ export class NodesPool {
|
|||
return Promise.all(
|
||||
nodeFiles.map(async (file) => {
|
||||
if (file.endsWith('.js')) {
|
||||
try {
|
||||
const nodeModule = await require(file)
|
||||
|
||||
if (nodeModule.nodeClass) {
|
||||
|
|
@ -59,6 +61,9 @@ export class NodesPool {
|
|||
this.componentNodes[newNodeInstance.name] = newNodeInstance
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(`❌ [server]: Error during initDatabase with file ${file}:`, err)
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export class App {
|
|||
// Initialize database
|
||||
this.AppDataSource.initialize()
|
||||
.then(async () => {
|
||||
logger.info('📦 [server]: Data Source has been initialized!')
|
||||
logger.info('📦 [server]: Data Source is being initialized!')
|
||||
|
||||
// Run Migrations Scripts
|
||||
await this.AppDataSource.runMigrations({ transaction: 'each' })
|
||||
|
|
@ -112,6 +112,7 @@ export class App {
|
|||
|
||||
// Initialize telemetry
|
||||
this.telemetry = new Telemetry()
|
||||
logger.info('📦 [server]: Data Source has been initialized!')
|
||||
})
|
||||
.catch((err) => {
|
||||
logger.error('❌ [server]: Error during Data Source initialization:', err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue