"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.clientErrorMessage = clientErrorMessage; const config_1 = require("../config"); /** * Returns a client-safe error message. Internal details are hidden in production. */ function clientErrorMessage(error, fallback = 'Request failed') { const msg = error instanceof Error ? error.message : String(error); const code = error?.code; if (config_1.config.env !== 'production') { return msg; } const exposeByCode = new Set([ 'WITHDRAWALS_DISABLED', 'WITHDRAWAL_NETWORK_DISABLED', 'HOT_WALLET_INSUFFICIENT_LIQUIDITY', 'INSUFFICIENT_BALANCE', 'DAILY_WITHDRAWAL_LIMIT_EXCEEDED', 'WITHDRAWAL_2FA_REQUIRED', ]); if (code && exposeByCode.has(code) && msg.trim()) { return msg; } if (error instanceof Error && error.message) { if (/^(Invalid|Unauthorized|Forbidden|Not found|2FA|Account|Password|Email|Phone|Referrer|referral)/i.test(msg)) { return msg; } if (/Withdrawals are disabled/i.test(msg)) { return msg; } } return fallback; } //# sourceMappingURL=safeError.js.map