fix: replace throw with logger.warn for missing commission wallets
App crashed on startup if COMMISSION_ENABLED=true but wallet addresses were missing. This prevented the admin panel from starting at all. Now logs a warning instead of crashing.
This commit is contained in:
@@ -19,21 +19,12 @@ import csvWriter from 'csv-writer';
|
||||
|
||||
export default class AdminWalletsHandler {
|
||||
static {
|
||||
// Проверка конфигурации комиссий
|
||||
if (config.COMMISSION_ENABLED) {
|
||||
const requiredFields = ['COMMISSION_PERCENT', 'COMMISSION_WALLETS'];
|
||||
const missingFields = requiredFields.filter(field => !config[field]);
|
||||
|
||||
if (missingFields.length > 0) {
|
||||
throw new Error(`Missing required commission configuration fields: ${missingFields.join(', ')}`);
|
||||
}
|
||||
|
||||
// Проверка кошельков для комиссий
|
||||
const requiredWallets = ['BTC', 'LTC', 'USDT', 'USDC', 'ETH'];
|
||||
const missingWallets = requiredWallets.filter(wallet => !config.COMMISSION_WALLETS[wallet]);
|
||||
|
||||
|
||||
if (missingWallets.length > 0) {
|
||||
throw new Error(`Missing commission wallet addresses for: ${missingWallets.join(', ')}`);
|
||||
logger.warn({ missingWallets }, `Commission enabled but wallet addresses missing for: ${missingWallets.join(', ')}. Commission features will be limited.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user