Add more info to client error stacktrace
This commit is contained in:
parent
7804e577de
commit
426a8cab45
1 changed files with 8 additions and 3 deletions
|
@ -95,9 +95,9 @@ class Logger {
|
|||
}
|
||||
|
||||
private buildStackServerLogPayload (message: LoggerMessage, meta?: LoggerMeta) {
|
||||
if (message instanceof Error) return message.stack
|
||||
if (meta instanceof Error) return meta.stack
|
||||
if (meta?.err instanceof Error) return meta.err.stack
|
||||
if (message instanceof Error) return this.buildStack(message)
|
||||
if (meta instanceof Error) return this.buildStack(meta)
|
||||
if (meta?.err instanceof Error) return this.buildStack(meta.err)
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
@ -128,6 +128,11 @@ class Logger {
|
|||
hookObj.hook(message, meta)
|
||||
}
|
||||
}
|
||||
|
||||
private buildStack (err: Error) {
|
||||
return `${err.message}\n${err.stack || ''}`
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const logger = window.logger || new Logger()
|
||||
|
|
Loading…
Reference in a new issue