Error Handling #30
Code-Over-Time
announced in
Tasks: Junior
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Category: Python Backend Development
Level: Junior
Description
When a player loads a game in Varcade Games, the web server (
website/server) will send a couple of requests to the stats server (stats_tracker/) to fetch the leaderboard and player stats for that game.If you open up
website/server/game_portal/game_portal/games/services.pyyou will find the code that sends these requests.The problem with this code is that it does not handle error scenarios. If the request fails for any reason and an exception is thrown it will not be handled gracefully and the server will return an uninformative 500 error.
Both the
get_leaderboardand theget_player_stats_for_gamefunctions need to be updated to handle error cases.If an error occurs it should be captured, and a helpful error message should be logged.
Also, an error in either of these requests should not cause the whole request to fail. Instead the API should be updated so that it returns an
emptyresponse for the leaderboard or player stats (or both - depending on what failed). The API should however indicate that an error occurred so that the client can display an error if it wants.Deliverable
Updated website server code that:
Acceptance Criteria
Task Tips!
Beta Was this translation helpful? Give feedback.
All reactions