diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-26 15:54:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-26 16:04:14 +0200 |
commit | d5b7d9110dd637a7f67ce9e430145314812a8df1 (patch) | |
tree | d019ef5fe68b14d7e5ad11953b6c1f4811669ce6 /server.ts | |
parent | 0dcf9a14be3f8668fe5ee65cf0365d457b4d1499 (diff) | |
download | PeerTube-d5b7d9110dd637a7f67ce9e430145314812a8df1.tar.gz PeerTube-d5b7d9110dd637a7f67ce9e430145314812a8df1.tar.zst PeerTube-d5b7d9110dd637a7f67ce9e430145314812a8df1.zip |
Fix error logging
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -27,13 +27,21 @@ const app = express() | |||
27 | // ----------- Core checker ----------- | 27 | // ----------- Core checker ----------- |
28 | import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' | 28 | import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' |
29 | 29 | ||
30 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | ||
31 | import { logger } from './server/helpers/logger' | ||
32 | import { ACCEPT_HEADERS, API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' | ||
33 | |||
30 | const missed = checkMissedConfig() | 34 | const missed = checkMissedConfig() |
31 | if (missed.length !== 0) { | 35 | if (missed.length !== 0) { |
32 | throw new Error('Your configuration files miss keys: ' + missed) | 36 | logger.error('Your configuration files miss keys: ' + missed) |
37 | process.exit(-1) | ||
33 | } | 38 | } |
34 | 39 | ||
35 | import { ACCEPT_HEADERS, API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' | ||
36 | checkFFmpeg(CONFIG) | 40 | checkFFmpeg(CONFIG) |
41 | .catch(err => { | ||
42 | logger.error('Error in ffmpeg check.', { err }) | ||
43 | process.exit(-1) | ||
44 | }) | ||
37 | 45 | ||
38 | const errorMessage = checkConfig() | 46 | const errorMessage = checkConfig() |
39 | if (errorMessage !== null) { | 47 | if (errorMessage !== null) { |
@@ -41,8 +49,6 @@ if (errorMessage !== null) { | |||
41 | } | 49 | } |
42 | 50 | ||
43 | // ----------- Database ----------- | 51 | // ----------- Database ----------- |
44 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | ||
45 | import { logger } from './server/helpers/logger' | ||
46 | 52 | ||
47 | // Initialize database and models | 53 | // Initialize database and models |
48 | import { initDatabaseModels } from './server/initializers/database' | 54 | import { initDatabaseModels } from './server/initializers/database' |