Closed SamuelSau closed 1 year ago
Creating axios error handler and setting default values for these information
Upon investigation, I tried using Riot's provided API to test using the summonerName "Happy" and found that the second axios.get() request gave me a 200 response status, but gave me an empty array. Further testing the Riot's Matches endpoints, I was still able to successfully get the list of matchIds and get all the match details from the last two endpoints.
Fixed bug.
The issue was solved by checking if summonerData was empty (or the length of the array === 0), then I set default values to queueType, tier, rank, wins, and losses. I also put safety measurements in the database for default values and ensured that they are not required for the future queries and requests.
Potential Unfixable Bug?
I've only tested using summonerName, DontThinkJustDo, for backend testing. However, using other summoner names led to undefined types for queueType, tier, rank, wins, losses.
For example: Happy
Accessing
https://na1.api.riotgames.com/lol/league/v4/entries/by-summoner/${summonerIdResponse.data.id}
whereconst summonerData = summmonerStatsResponse.data[0];
cannot accesssummonerData.queueType
and etc.Using applications such as op.gg or blitz.gg also were unable to retrieve these information.
I assume since the season restarted for League of Legends in preparation for Season 13 sometime in January, Riot API has reset these information. Furthermore, I believe that could be the case of a timer set in place when playing a certain gamemode such as ranked queue that expires after some time and resets, hence why DontThinkJustDo's information is still present.