Skip to content

Commit

Permalink
Do not throw from Task.Run callback
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnygunawan committed Feb 3, 2024
1 parent 57392d5 commit ebe572f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ await telegramBotClient.SendTextMessageAsync(
replyToMessageId: textPrompt.Command.MessageId,
cancellationToken: cancellationToken
);
throw;
return;
}

// Track thread
Expand Down
2 changes: 1 addition & 1 deletion BotNet.CommandHandlers/AI/OpenAI/AskCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ await telegramBotClient.EditMessageTextAsync(
parseMode: ParseMode.Html,
cancellationToken: cancellationToken
);
throw;
return;
}

// Track thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ await _telegramBotClient.DeleteMessageAsync(
} catch (OperationCanceledException) {
// Terminate gracefully
// TODO: tie up loose ends
} catch (Exception exc) {
_logger.LogError(exc, "Could not handle command");
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ await telegramBotClient.EditMessageTextAsync(
parseMode: ParseMode.Html,
cancellationToken: cancellationToken
);
throw;
return;
}

// Track thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ await telegramBotClient.EditMessageTextAsync(
parseMode: ParseMode.Html,
cancellationToken: cancellationToken
);
throw;
return;
}

// Track thread
Expand Down

0 comments on commit ebe572f

Please sign in to comment.