mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-24 02:16:41 +02:00
🔧 fix(telegram-bot): improve database connection logging and error messages
- Add connection test on startup (SELECT 1) - Log masked database URL on connection attempt - Better error messages for /users command
This commit is contained in:
parent
79e3c09af2
commit
021c6e789e
2 changed files with 23 additions and 9 deletions
|
|
@ -67,13 +67,21 @@ export class BotUpdate {
|
|||
this.logger.log(`/users command from ${ctx.from?.id}`);
|
||||
await ctx.reply('👥 Lade User-Statistiken...');
|
||||
|
||||
const stats = await this.usersService.getUserStats();
|
||||
if (!stats) {
|
||||
await ctx.reply('❌ Datenbank nicht verfügbar');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const stats = await this.usersService.getUserStats();
|
||||
if (!stats) {
|
||||
this.logger.warn('User stats returned null - database may not be configured');
|
||||
await ctx.reply('❌ Datenbank nicht verfügbar. Prüfe DATABASE_URL Konfiguration.');
|
||||
return;
|
||||
}
|
||||
|
||||
const report = formatUsersReport(stats);
|
||||
await ctx.replyWithHTML(report);
|
||||
const report = formatUsersReport(stats);
|
||||
await ctx.replyWithHTML(report);
|
||||
} catch (error) {
|
||||
this.logger.error('Failed to get user stats:', error);
|
||||
await ctx.reply(
|
||||
`❌ Fehler beim Laden der User-Statistiken: ${error instanceof Error ? error.message : 'Unbekannter Fehler'}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue