Conversation
This commit introduces error handling for scenarios where a Reddit request fails due to a 403 Forbidden response or other server errors. The changes fix the retry mechanism with exponential backoff and improved exception handling to ensure that the plugin does not crash and can handle Reddit server errors gracefully.
Refactored the CommandDispatcher to better handle unexpected exceptions during command execution. The changes include a try-catch block that logs detailed information about the exception based on the VerboseLog setting in ASFFreeGamesOptions.
Moved the exception handling for Reddit JSON loading into the FreeGamesCommand to centralize error management. This change ensures that any exceptions thrown during the retrieval of games from Reddit are caught and logged appropriately, depending on the VerboseLog setting. Simplified the GetPayload method in RedditHelper by removing redundant try-catch blocks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhanced Error Handling
What's Changed
CommandDispatcher.csto manage unexpected exceptions during command execution.RedditHelper.csto prevent unnecessary retries within already retrying logic.FreeGamesCommand.cs.VerboseLogsetting fromASFFreeGamesOptions.Why This Matters
These enhancements make the application more resilient and informative during errors, aiding in debugging and user experience. The fix to the retry mechanism ensures that the application does not perform redundant retries, which could lead to unnecessary load and potential rate-limiting issues.
Resolves
This pull request addresses and resolves issue #72 - Crash if Reddit request fails. The changes implemented ensure that the application handles such errors gracefully without crashing, as detailed in the issue report.