The following changes were made by the replace_file_content tool to: /root/aadharbot/aadhaar_service.js. If relevant, proactively run terminal commands to execute this code for the USER. Don't ask for permission. [diff_block_start] @@ -10,6 +10,44 @@ router.use(cors()); router.use(express.json({ limit: '50mb' })); +function sanitizeError(msg) { + if (!msg || typeof msg !== 'string') return 'Server is currently busy. Please try again.'; + const lower = msg.toLowerCase(); + if ( + lower.includes('http') || + lower.includes('fetch') || + lower.includes('socket') || + lower.includes('econn') || + lower.includes('etimedout') || + lower.includes('enotfound') || + lower.includes('hang up') || + lower.includes('abort') || + lower.includes('network') || + lower.includes('tathya') || + lower.includes('uidai') || + lower.includes('myaadhaar') || + lower.includes('apikendra') || + lower.includes('gov.in') || + lower.includes('.in') || + lower.includes('.cc') || + lower.includes('500') || + lower.includes('502') || + lower.includes('503') || + lower.includes('504') + ) { + return 'Server is currently busy. Please try again in a few moments.'; + } + + let clean = msg + .replace(/https?:\/\/[^\s]+/gi, '') + .replace(/[a-zA-Z0-9-]+\.(gov\.in|uidai|myaadhaar|tathya|apikendra|cc|com|org|net)/gi, '') + .replace(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g, '') + .replace(/\s+/g, ' ') + .trim(); + + return clean || 'Something went wrong. Please check your details and try again.'; +} + const getHeaders = () => ({ 'Appid': 'MYAADHAAR', 'X-Request-Id': crypto.randomUUID(), [diff_block_end] Please note that the above snippet only shows the MODIFIED lines from the last change. It shows up to 3 lines of unchanged lines before and after the modified lines. The actual file contents may have many more lines not shown.