ASFFreeGames
ASFFreeGames copied to clipboard
Crash if reddit request fails
Describe the bug If the reddit request failes, ASF crashes. In my scenario, this is probably caused by the ip pool of the server or a rate limit.
To Reproduce Steps to reproduce the behavior:
- Get blocked by reddit (HTTP 403 Blocked/Forbidden)
- Run the plugin
Expected behavior Error should be handled and dont crash.
Screenshots
[22:53:29] INFO Zulu > Init() Success!
[22:53:29] INFO Zulu > IsAnythingToFarm() Checking first badge page...
[22:53:30] INFO Zulu > StartFarming() We don't have anything to farm on this account!
[22:53:41] DEBUG ASF > InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:41] WARN ASF > UrlGetToStream() Request failed after 5 attempts!
[22:53:41] DEBUG ASF > UrlGetToStream() Request failing: https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:41] DEBUG ASF > InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:41] WARN ASF > UrlGetToStream() Request failed after 5 attempts!
[22:53:41] DEBUG ASF > UrlGetToStream() Request failing: https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:41] DEBUG ASF > InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:41] WARN ASF > UrlGetToStream() Request failed after 5 attempts!
[22:53:41] DEBUG ASF > UrlGetToStream() Request failing: https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:42] DEBUG ASF > InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:42] WARN ASF > UrlGetToStream() Request failed after 5 attempts!
[22:53:42] DEBUG ASF > UrlGetToStream() Request failing: https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:44] DEBUG ASF > InternalRequest() Forbidden <- GET https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:44] WARN ASF > UrlGetToStream() Request failed after 5 attempts!
[22:53:44] DEBUG ASF > UrlGetToStream() Request failing: https://www.reddit.com/user/ASFinfo.json?sort=new
[22:53:44] FATAL ASF > OnUnhandledException() Maxisoft.ASF.Reddit.RedditServerException: Reddit server error: content is null at Maxisoft.ASF.Reddit.RedditHelper.GetPayload(WebBrowser webBrowser, CancellationToken cancellationToken, UInt32 retry) at Maxisoft.ASF.Reddit.RedditHelper.GetPayload(WebBrowser webBrowser, CancellationToken cancellationToken, UInt32 retry) at Maxisoft.ASF.Reddit.RedditHelper.GetGames(CancellationToken cancellationToken) at ASFFreeGames.Commands.FreeGamesCommand.CollectGames(IEnumerable`1 bots, ECollectGameRequestSource requestSource, CancellationToken cancellationToken) at ASFFreeGames.Commands.FreeGamesCommand.HandleInternalCollectCommand(Bot bot, String[] args, CancellationToken cancellationToken) at ASFFreeGames.Commands.FreeGamesCommand.Execute(Bot bot, String message, String[] args, UInt64 steamID, CancellationToken cancellationToken) at ASFFreeGames.Commands.CommandDispatcher.Execute(Bot bot, String message, String[] args, UInt64 steamID, CancellationToken cancellationToken) at Maxisoft.ASF.ASFFreeGamesPlugin.OnBotCommand(Bot bot, EAccess access, String message, String[] args, UInt64 steamID) at Maxisoft.ASF.ASFFreeGamesPlugin.CollectGamesOnClock(Object source) at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext, Action`1, TState& ) at System.Threading.QueueUserWorkItemCallback.Execute() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback()
[22:53:44] ERROR ASF > Exit() Exiting with 1 error code!
[22:53:44] INFO Microsoft.Hosting.Lifetime > Application is shutting down...
ASF:
- ASF: v6.0.2.6
- Plugin: v1.5.2