Show any errors when logging in

This commit is contained in:
Tulir Asokan 2018-12-13 22:36:47 +02:00
parent 66aef1978c
commit adc762b9dd

View file

@ -42,5 +42,8 @@ def login(server, username, password) -> None:
save_config()
print(Fore.GREEN + "Logged in successfully")
except HTTPError as e:
if e.code == 401:
print(Fore.RED + "Invalid username or password" + Fore.RESET)
try:
err = json.load(e)
except json.JSONDecodeError:
err = {}
print(Fore.RED + err.get("error", str(e)) + Fore.RESET)