aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/root-helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-17 09:53:47 +0200
committerChocobozzz <me@florianbigard.com>2022-08-17 09:53:47 +0200
commit426a8cab459dd924df50d4e27f15feba4819b859 (patch)
tree573070cfe84bac3311d9be0f5801b964bf952abe /client/src/root-helpers
parent7804e577de25345da51ac3d88f6121108012b523 (diff)
downloadPeerTube-426a8cab459dd924df50d4e27f15feba4819b859.tar.gz
PeerTube-426a8cab459dd924df50d4e27f15feba4819b859.tar.zst
PeerTube-426a8cab459dd924df50d4e27f15feba4819b859.zip
Add more info to client error stacktrace
Diffstat (limited to 'client/src/root-helpers')
-rw-r--r--client/src/root-helpers/logger.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/client/src/root-helpers/logger.ts b/client/src/root-helpers/logger.ts
index cd559cfa7..0dcda525e 100644
--- a/client/src/root-helpers/logger.ts
+++ b/client/src/root-helpers/logger.ts
@@ -95,9 +95,9 @@ class Logger {
95 } 95 }
96 96
97 private buildStackServerLogPayload (message: LoggerMessage, meta?: LoggerMeta) { 97 private buildStackServerLogPayload (message: LoggerMessage, meta?: LoggerMeta) {
98 if (message instanceof Error) return message.stack 98 if (message instanceof Error) return this.buildStack(message)
99 if (meta instanceof Error) return meta.stack 99 if (meta instanceof Error) return this.buildStack(meta)
100 if (meta?.err instanceof Error) return meta.err.stack 100 if (meta?.err instanceof Error) return this.buildStack(meta.err)
101 101
102 return undefined 102 return undefined
103 } 103 }
@@ -128,6 +128,11 @@ class Logger {
128 hookObj.hook(message, meta) 128 hookObj.hook(message, meta)
129 } 129 }
130 } 130 }
131
132 private buildStack (err: Error) {
133 return `${err.message}\n${err.stack || ''}`
134
135 }
131} 136}
132 137
133const logger = window.logger || new Logger() 138const logger = window.logger || new Logger()