MCPcopy
hub / github.com/codeaashu/claude-code / sanitizeAndLogError

Function sanitizeAndLogError

src/components/Feedback.tsx:502–517  ·  view source on GitHub ↗
(err: unknown)

Source from the content-addressed store, hash-verified

500
501// Helper function to sanitize and log errors without exposing API keys
502function 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}
518async function submitFeedback(data: FeedbackData, signal?: AbortSignal): Promise<{
519 success: boolean;
520 feedbackId?: string;

Callers 1

submitFeedbackFunction · 0.85

Calls 2

redactSensitiveInfoFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected