git » sdk » commit 4cf466d

Store errors from MAM also

author Stephen Paul Weber
2025-11-29 03:47:56 UTC
committer Stephen Paul Weber
2025-11-29 04:01:02 UTC
parent c420d7dbe5eadb29c35aa70082d6bcbcb0155e2c

Store errors from MAM also

borogove/Chat.hx +14 -0
borogove/Client.hx +7 -0

diff --git a/borogove/Chat.hx b/borogove/Chat.hx
index b0a4f13..c7d7975 100644
--- a/borogove/Chat.hx
+++ b/borogove/Chat.hx
@@ -170,6 +170,13 @@ abstract class Chat {
 						persistence.storeReaction(client.accountId(), update);
 					case ModerateMessageStanza(action):
 						client.moderateMessage(action);
+					case ErrorMessageStanza(localId, stanza):
+						persistence.updateMessageStatus(
+							client.accountId(),
+							localId,
+							MessageFailedToSend,
+							stanza.getErrorText(),
+						);
 					default:
 						// ignore
 					}
@@ -1447,6 +1454,13 @@ class Channel extends Chat {
 						promises.push(new thenshim.Promise((resolve, reject) -> {
 							client.moderateMessage(action).then((_) -> resolve(null));
 						}));
+					case ErrorMessageStanza(localId, stanza):
+						promises.push(persistence.updateMessageStatus(
+							client.accountId(),
+							localId,
+							MessageFailedToSend,
+							stanza.getErrorText(),
+						).then(m -> [m]));
 					default:
 						// ignore
 				}
diff --git a/borogove/Client.hx b/borogove/Client.hx
index faff450..2bbbd95 100644
--- a/borogove/Client.hx
+++ b/borogove/Client.hx
@@ -1758,6 +1758,13 @@ class Client extends EventEmitter {
 						promises.push(new thenshim.Promise((resolve, reject) -> {
 							moderateMessage(action).then((_) -> resolve(null));
 						}));
+					case ErrorMessageStanza(localId, stanza):
+						promises.push(persistence.updateMessageStatus(
+							accountId(),
+							localId,
+							MessageFailedToSend,
+							stanza.getErrorText(),
+						).then(m -> [m]));
 					default:
 						// ignore
 				}