throw exception from QRs window-function if no match

This commit is contained in:
LenAnderson
2024-04-02 12:55:59 -04:00
parent 3b545a7ab1
commit 12a5105312

View File

@@ -183,14 +183,16 @@ const init = async () => {
; ;
if (!qr) { if (!qr) {
let [setName, ...qrName] = name.split('.'); let [setName, ...qrName] = name.split('.');
name = qrName.join('.'); qrName = qrName.join('.');
let qrs = QuickReplySet.get(setName); let qrs = QuickReplySet.get(setName);
if (qrs) { if (qrs) {
qr = qrs.qrList.find(it=>it.label == name); qr = qrs.qrList.find(it=>it.label == qrName);
} }
} }
if (qr && qr.onExecute) { if (qr && qr.onExecute) {
return await qr.execute(args); return await qr.execute(args);
} else {
throw new Error(`No Quick Reply found for "${name}".`);
} }
}; };