1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Don't stop polling if an exception occours

This commit is contained in:
Steffo 2016-08-16 15:28:07 +02:00
parent 9ea76f6f01
commit e257547b13

11
main.py
View file

@ -39,6 +39,9 @@ async def overwatch_level_up(timeout):
r = await overwatch.get_player_data(**db[player]["overwatch"]) r = await overwatch.get_player_data(**db[player]["overwatch"])
except overwatch.NotFoundException: except overwatch.NotFoundException:
print("[Overwatch] Player not found.") print("[Overwatch] Player not found.")
except Exception:
# If some other error occours, skip the player
print("[Overwatch] Request returned an unhandled exception.")
else: else:
if "level" not in db[player]["overwatch"] \ if "level" not in db[player]["overwatch"] \
or r["data"]["level"] > db[player]["overwatch"]["level"]: or r["data"]["level"] > db[player]["overwatch"]["level"]:
@ -71,10 +74,13 @@ async def league_rank_change(timeout):
r = await league.get_player_rank(**db[player]["league"]) r = await league.get_player_rank(**db[player]["league"])
except league.NoRankedGamesCompletedException: except league.NoRankedGamesCompletedException:
# If the player has no ranked games completed, skip him # If the player has no ranked games completed, skip him
continue pass
except league.RateLimitException: except league.RateLimitException:
# If you've been ratelimited, skip the player and notify the console. # If you've been ratelimited, skip the player and notify the console.
print("[League] Request rejected for rate limit.") print("[League] Request rejected for rate limit.")
except Exception:
# If some other error occours, skip the player
print("[League] Request returned an unhandled exception.")
else: else:
# Convert tier into a number # Convert tier into a number
tier_number = league.ranklist.index(r["tier"]) tier_number = league.ranklist.index(r["tier"])
@ -115,6 +121,9 @@ async def league_level_up(timeout):
except league.RateLimitException: except league.RateLimitException:
# If you've been ratelimited, skip the player and notify the console. # If you've been ratelimited, skip the player and notify the console.
print("[League] Request rejected for rate limit.") print("[League] Request rejected for rate limit.")
except Exception:
# If some other error occours, skip the player
print("[League] Request returned an unhandled exception.")
else: else:
# Check for level changes # Check for level changes
if "level" not in db[player]["league"] or r["summonerLevel"] > db[player]["league"]["level"]: if "level" not in db[player]["league"] or r["summonerLevel"] > db[player]["league"]["level"]: