feat: enhance error handling and retry logic for Discord bot connections

This commit is contained in:
2025-09-22 22:00:11 -05:00
parent 468480478a
commit de7bcccb88
4 changed files with 152 additions and 18 deletions

View File

@@ -32,7 +32,8 @@ class Amayo extends Client {
async play () {
if(!this.key) {
return console.error('No key provided');
console.error('No key provided');
throw new Error('Missing DISCORD TOKEN');
} else {
// Ejemplo de cómo usarías prisma antes de iniciar sesión
try {
@@ -40,7 +41,8 @@ class Amayo extends Client {
console.log('Successfully connected to the database.');
await this.login(this.key);
} catch (error) {
console.error('Failed to connect to the database:', error);
console.error('Failed to connect to DB or login to Discord:', error);
throw error; // Propaga para que withRetry en main.ts reintente
}
}
}