()
| 56 | } |
| 57 | |
| 58 | getDetailedMessage(): string { |
| 59 | const contextStr = Object.entries(this.context) |
| 60 | .map(([key, value]) => { |
| 61 | const serialized = (() => { |
| 62 | if (value === undefined) return "undefined"; |
| 63 | if (value === null) return "null"; |
| 64 | if (typeof value === "bigint") return value.toString(); |
| 65 | if (typeof value === "object") { |
| 66 | try { |
| 67 | return JSON.stringify(value); |
| 68 | } catch { |
| 69 | return "<unserializable>"; |
| 70 | } |
| 71 | } |
| 72 | return String(value); |
| 73 | })(); |
| 74 | return `${key}: ${serialized}`; |
| 75 | }) |
| 76 | .join(", "); |
| 77 | |
| 78 | let message = `[${this.code}] ${this.message}`; |
| 79 | if (contextStr) { |
| 80 | message += ` (${contextStr})`; |
| 81 | } |
| 82 | if (this.cause) { |
| 83 | message += `\nCaused by: ${this.cause.message}`; |
| 84 | } |
| 85 | return message; |
| 86 | } |
| 87 | } |
no outgoing calls
no test coverage detected