From d039f313c685559e567f20432218b3d305d12435 Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 29 Jan 2024 19:59:44 +0100 Subject: [PATCH] feat: super crude way to throw errors when sending --- src/aioappsrv/app.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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