Improve error handling
This commit is contained in:
parent
9f2cc875f9
commit
db1b48ee02
1 changed files with 4 additions and 7 deletions
|
@ -106,10 +106,6 @@ def fetch_user(user_id):
|
|||
|
||||
def fetch_top_n(n):
|
||||
output = get_top_N('score', True, n)
|
||||
|
||||
if output == '[]':
|
||||
output = None
|
||||
|
||||
return output
|
||||
|
||||
|
||||
|
@ -126,12 +122,13 @@ def process_request(uri):
|
|||
output = None
|
||||
|
||||
if len(parts) < 2:
|
||||
return None
|
||||
|
||||
if parts[1] == 'users':
|
||||
output = None
|
||||
elif parts[1] == 'users':
|
||||
output = fetch_user(parts[2])
|
||||
elif parts[1] == 'top':
|
||||
output = fetch_top_n(parts[2])
|
||||
else:
|
||||
output = None
|
||||
|
||||
return output
|
||||
|
||||
|
|
Reference in a new issue