From adc762b9ddcf2ba3a45c54d853f7a9db2669758e Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 13 Dec 2018 22:36:47 +0200 Subject: [PATCH] Show any errors when logging in --- maubot/cli/commands/login.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/maubot/cli/commands/login.py b/maubot/cli/commands/login.py index aa138a9..7171a6e 100644 --- a/maubot/cli/commands/login.py +++ b/maubot/cli/commands/login.py @@ -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)