Improve error handling

This commit is contained in:
Corder Guy 2018-04-17 14:35:29 -05:00
parent 9f2cc875f9
commit db1b48ee02

View file

@ -106,10 +106,6 @@ def fetch_user(user_id):
def fetch_top_n(n): def fetch_top_n(n):
output = get_top_N('score', True, n) output = get_top_N('score', True, n)
if output == '[]':
output = None
return output return output
@ -126,12 +122,13 @@ def process_request(uri):
output = None output = None
if len(parts) < 2: if len(parts) < 2:
return None output = None
elif parts[1] == 'users':
if parts[1] == 'users':
output = fetch_user(parts[2]) output = fetch_user(parts[2])
elif parts[1] == 'top': elif parts[1] == 'top':
output = fetch_top_n(parts[2]) output = fetch_top_n(parts[2])
else:
output = None
return output return output