MCPcopy Create free account
hub / github.com/Noumena-Network/code / sanitizeAndLogError

Function sanitizeAndLogError

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

Source from the content-addressed store, hash-verified

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

Callers 1

submitFeedbackFunction · 0.85

Calls 2

redactSensitiveInfoFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected