diff --git a/src/aioappsrv/app.py b/src/aioappsrv/app.py index 59f5097..48d1e59 100644 --- a/src/aioappsrv/app.py +++ b/src/aioappsrv/app.py @@ -104,8 +104,12 @@ class AppService: json=mx_message(text), ) as res: doc = await res.json() - self.logger.debug("sent message %s to %s as %s : %s", text, room, mxid, doc) - return doc["event_id"] + if "event_id" in doc: + self.logger.debug("sent message %s to %s as %s : %s", text, room, mxid, doc) + return doc["event_id"] + else: + self.logger.error("failed sending message: %s", doc) + raise ValueError(doc) async def redact_message(self): raise NotImplementedError