diff options
Diffstat (limited to 'server/initializers/database.ts')
-rw-r--r-- | server/initializers/database.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/server/initializers/database.ts b/server/initializers/database.ts index dfad01581..141566c3a 100644 --- a/server/initializers/database.ts +++ b/server/initializers/database.ts | |||
@@ -84,9 +84,14 @@ database.init = async (silent: boolean) => { | |||
84 | const filePaths = await getModelFiles(modelDirectory) | 84 | const filePaths = await getModelFiles(modelDirectory) |
85 | 85 | ||
86 | for (const filePath of filePaths) { | 86 | for (const filePath of filePaths) { |
87 | const model = sequelize.import(filePath) | 87 | try { |
88 | const model = sequelize.import(filePath) | ||
88 | 89 | ||
89 | database[model['name']] = model | 90 | database[model['name']] = model |
91 | } catch (err) { | ||
92 | logger.error('Cannot import database model %s.', filePath, err) | ||
93 | process.exit(0) | ||
94 | } | ||
90 | } | 95 | } |
91 | 96 | ||
92 | for (const modelName of Object.keys(database)) { | 97 | for (const modelName of Object.keys(database)) { |