fix initDatabase function by proper use of await in try catch (#2360)

* fix initDatabase function by proper use of await in try catch

* lint-fix

---------

Co-authored-by: Henry Heng <henryheng@flowiseai.com>
This commit is contained in:
Saurabh Gupta
2024-05-13 16:45:22 +05:30
committed by GitHub
parent ee9d3a33fa
commit 823cefb5c5
+5 -6
View File
@@ -43,8 +43,8 @@ export class App {
async initDatabase() {
// Initialize database
this.AppDataSource.initialize()
.then(async () => {
try {
await this.AppDataSource.initialize()
logger.info('📦 [server]: Data Source is initializing...')
// Run Migrations Scripts
@@ -73,10 +73,9 @@ 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)
})
} catch (error) {
logger.error('❌ [server]: Error during Data Source initialization:', error)
}
}
async config(socketIO?: Server) {