fix: add logging error stack on home server failure

This commit is contained in:
Karol Sójko 2023-07-27 12:00:40 +02:00
parent 9bd97b95e9
commit f7471119e1
No known key found for this signature in database
GPG key ID: 50D9C5A8D4B8D73F

View file

@ -6,16 +6,21 @@ const homeServer = new HomeServer()
const env: Env = new Env()
env.load()
Promise.resolve(
homeServer.start({
dataDirectoryPath: `${__dirname}/../data`,
logStreamCallback: (chunk: Buffer) => {
// eslint-disable-next-line no-console
console.log(chunk.toString())
},
environment: env.getAll(),
}),
).catch((error) => {
try {
Promise.resolve(
homeServer.start({
dataDirectoryPath: `${__dirname}/../data`,
logStreamCallback: (chunk: Buffer) => {
// eslint-disable-next-line no-console
console.log(chunk.toString())
},
environment: env.getAll(),
}),
).catch((error) => {
// eslint-disable-next-line no-console
console.error(`Could not start server: ${error.message}`)
})
} catch (error) {
// eslint-disable-next-line no-console
console.log(`Could not start server: ${error.message}`)
})
console.error((error as Error).stack)
}