浏览代码

Catch and log parser errors

JC Brand 3 年之前
父节点
当前提交
8ad097f23f
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/headless/plugins/chat/utils.js

+ 6 - 1
src/headless/plugins/chat/utils.js

@@ -115,7 +115,12 @@ export async function handleMessageStanza (stanza) {
         const from = stanza.getAttribute('from');
         return log.info(`handleMessageStanza: Ignoring incoming server message from JID: ${from}`);
     }
-    const attrs = await parseMessage(stanza, _converse);
+    let attrs;
+    try {
+        attrs = await parseMessage(stanza, _converse);
+    } catch (e) {
+        return log.error(e);
+    }
     if (u.isErrorObject(attrs)) {
         attrs.stanza && log.error(attrs.stanza);
         return log.error(attrs.message);