From 6d4c2e174f6f474feedd8e1698be01695a67c537 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 22 Nov 2021 18:05:34 +0200 Subject: [PATCH] Fix wrong error message in some client updates --- maubot/management/api/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/maubot/management/api/client.py b/maubot/management/api/client.py index 3d88506..c74f9e9 100644 --- a/maubot/management/api/client.py +++ b/maubot/management/api/client.py @@ -89,7 +89,11 @@ async def _update_client(client: Client, data: dict, is_login: bool = False) -> except MatrixConnectionError: return resp.bad_client_connection_details except ValueError as e: - return resp.mxid_mismatch(str(e)[len("MXID mismatch: "):]) + str_err = str(e) + if str_err.startswith("MXID mismatch"): + return resp.mxid_mismatch(str(e)[len("MXID mismatch: "):]) + elif str_err.startswith("Device ID mismatch"): + return resp.device_id_mismatch(str(e)[len("Device ID mismatch: "):]) with client.db_instance.edit_mode(): await client.update_avatar_url(data.get("avatar_url", None)) await client.update_displayname(data.get("displayname", None))