(err: unknown)
| 500 | |
| 501 | // Helper function to sanitize and log errors without exposing API keys |
| 502 | function sanitizeAndLogError(err: unknown): void { |
| 503 | if (err instanceof Error) { |
| 504 | // Create a copy with potentially sensitive info redacted |
| 505 | const safeError = new Error(redactSensitiveInfo(err.message)); |
| 506 | |
| 507 | // Also redact the stack trace if present |
| 508 | if (err.stack) { |
| 509 | safeError.stack = redactSensitiveInfo(err.stack); |
| 510 | } |
| 511 | logError(safeError); |
| 512 | } else { |
| 513 | // For non-Error objects, convert to string and redact sensitive info |
| 514 | const errorString = redactSensitiveInfo(String(err)); |
| 515 | logError(new Error(errorString)); |
| 516 | } |
| 517 | } |
| 518 | async function submitFeedback(data: FeedbackData, signal?: AbortSignal): Promise<{ |
| 519 | success: boolean; |
| 520 | feedbackId?: string; |
no test coverage detected