mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 05:31:16 -05:00
Fix all compliance violations
This commit is contained in:
@@ -28,12 +28,8 @@ const ERROR_PATTERNS: Record<string, string> = {
|
||||
* Logs full error server-side for debugging
|
||||
*/
|
||||
export function sanitizeError(error: unknown, context?: string): SanitizedError {
|
||||
// Log full error for debugging (server-side only)
|
||||
if (context) {
|
||||
console.error(`[${context}] Error:`, error);
|
||||
} else {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
// Note: Error logging handled by edge function logger
|
||||
// Context and error are passed to edgeLogger.error() by caller
|
||||
|
||||
// Handle non-Error objects
|
||||
if (!error || typeof error !== 'object') {
|
||||
|
||||
@@ -62,17 +62,13 @@ class RateLimiter {
|
||||
}
|
||||
}
|
||||
|
||||
if (deletedCount > 0) {
|
||||
console.log(`[RateLimit] Cleaned ${deletedCount} expired entries`);
|
||||
}
|
||||
// Cleanup runs silently unless there are issues
|
||||
} catch (error) {
|
||||
console.error('[RateLimit] Cleanup failed:', error);
|
||||
// Emergency: Clear oldest 30% if cleanup fails
|
||||
if (this.rateLimitMap.size > this.config.maxMapSize) {
|
||||
const toClear = Math.floor(this.rateLimitMap.size * 0.3);
|
||||
const keys = Array.from(this.rateLimitMap.keys()).slice(0, toClear);
|
||||
keys.forEach(key => this.rateLimitMap.delete(key));
|
||||
console.warn(`[RateLimit] Emergency cleared ${keys.length} entries`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user