Skip to content

Commit f82f5cd

Browse files
committed
Add logger in error handler
1 parent e442227 commit f82f5cd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Telegram.Net/Services/TelegramHostedService.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ public async Task StartAsync(CancellationToken cancellationToken)
240240

241241
Client.StartReceiving(
242242
UpdateHandler,
243-
Config.errorHandler ?? ((_, _, _) => Task.CompletedTask),
243+
Config.errorHandler ?? ((_, ex, _) =>
244+
{
245+
_logger.LogError(ex, "Catched error in telegram bot working: ");
246+
return Task.CompletedTask;
247+
}),
244248
Config.ReceiverOptions,
245249
cancellationToken);
246250
}

0 commit comments

Comments
 (0)