Archived
1
0

app.ts: Fix createApp to log all http server errors

cc @code-asher
This commit is contained in:
Anmol Sethi
2021-01-14 09:49:23 -05:00
parent 8acb2aec11
commit d3074278ca
3 changed files with 27 additions and 14 deletions

View File

@ -112,3 +112,11 @@ export const getFirstString = (value: string | string[] | object | undefined): s
return typeof value === "string" ? value : undefined
}
export function logError(prefix: string, err: any): void {
if (err instanceof Error) {
logger.error(`${prefix}: ${err.message} ${err.stack}`)
} else {
logger.error(`${prefix}: ${err}`)
}
}