(message: string, stack?: string)
| 26 | } |
| 27 | |
| 28 | export function reportError(message: string, stack?: string): void { |
| 29 | if (!message) return |
| 30 | const key = `${message}::${stack?.split('\n')[1] ?? ''}` |
| 31 | if (!shouldReport(key)) return |
| 32 | // Fire-and-forget; never let reporting throw or block the UI. |
| 33 | void post('/logs/report', { |
| 34 | level: 'error', |
| 35 | message, |
| 36 | stack, |
| 37 | url: typeof location !== 'undefined' ? location.href : undefined, |
| 38 | }).catch(() => {}) |
| 39 | } |
| 40 | |
| 41 | /** Install global handlers. Call once at app startup. */ |
| 42 | export function installGlobalErrorReporting(): void { |
no test coverage detected