Browse Source

Add error info to bad credentials states

Tulir Asokan 3 years ago
parent
commit
6508dcd912
2 changed files with 7 additions and 2 deletions
  1. 6 1
      mautrix_instagram/user.py
  2. 1 1
      requirements.txt

+ 6 - 1
mautrix_instagram/user.py

@@ -365,7 +365,9 @@ class User(DBUser, BaseUser):
         self.mqtt = None
         if isinstance(e, IGConsentRequiredError):
             await self.push_bridge_state(
-                BridgeStateEvent.BAD_CREDENTIALS, error="ig-consent-required"
+                BridgeStateEvent.BAD_CREDENTIALS,
+                error="ig-consent-required",
+                info=e.body.serialize(),
             )
             return
         error_code = "ig-checkpoint"
@@ -376,6 +378,9 @@ class User(DBUser, BaseUser):
                 error_code = "ig-checkpoint-locked"
         except Exception:
             self.log.exception("Error resetting challenge state")
+        await self.push_bridge_state(
+            BridgeStateEvent.BAD_CREDENTIALS, error=error_code, info=e.body.serialize()
+        )
         # if on == "connect":
         #     await self.connect()
         # else:

+ 1 - 1
requirements.txt

@@ -4,7 +4,7 @@ commonmark>=0.8,<0.10
 aiohttp>=3,<4
 yarl>=1,<2
 attrs>=20.1
-mautrix>=0.15.4,<0.16
+mautrix>=0.15.7,<0.16
 asyncpg>=0.20,<0.26
 pycryptodome>=3,<4
 paho-mqtt>=1.5,<2