From bfdfb2080a11de548f1353289ebd534d4374c630 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 27 Jan 2018 18:01:43 +0200 Subject: [PATCH] Don't crash if registration returns HTTP 500 --- mautrix_appservice/intent_api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mautrix_appservice/intent_api.py b/mautrix_appservice/intent_api.py index 5870e34f..4b56c35b 100644 --- a/mautrix_appservice/intent_api.py +++ b/mautrix_appservice/intent_api.py @@ -300,7 +300,9 @@ class IntentAPI: try: self.client.register({"username": self.localpart}) except MatrixRequestError as e: - if matrix_error_code(e) != "M_USER_IN_USE": + if matrix_error_code(e) == "M_UNKNOWN": + self.log.exception("Internal server error while registering!") + elif matrix_error_code(e) != "M_USER_IN_USE": raise IntentError(f"Failed to register {self.mxid}", e) self.registered = True