Improve robustness: surround the 'id' fetch from result array with a try clause.
This commit is contained in:
parent
d1ee9b7696
commit
ec6099421b
@ -33,6 +33,9 @@ class UsernameToUUID:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
json_data = json.loads(response)
|
json_data = json.loads(response)
|
||||||
|
try:
|
||||||
uuid = json_data['id']
|
uuid = json_data['id']
|
||||||
|
except KeyError as e:
|
||||||
|
print("KeyError raised:", e);
|
||||||
|
|
||||||
return uuid
|
return uuid
|
||||||
|
Loading…
Reference in New Issue
Block a user