This commit is contained in:
Pieter Vander Vennet 2023-09-24 01:25:00 +02:00
parent 4d2d54175c
commit 56934b79f6
3 changed files with 17 additions and 9 deletions

View file

@ -98,7 +98,7 @@ export class TagUtils {
"Invalid type to flatten the multiAnswer: key is a regex too", "Invalid type to flatten the multiAnswer: key is a regex too",
tagsFilter tagsFilter
) )
throw "Invalid type to FlattenMultiAnswer" throw "Invalid type to FlattenMultiAnswer: key is a regex too"
} }
const keystr = <string>key const keystr = <string>key
if (keyValues[keystr] === undefined) { if (keyValues[keystr] === undefined) {
@ -109,7 +109,10 @@ export class TagUtils {
} }
console.error("Invalid type to flatten the multiAnswer", tagsFilter) console.error("Invalid type to flatten the multiAnswer", tagsFilter)
throw "Invalid type to FlattenMultiAnswer" throw (
"Invalid type to FlattenMultiAnswer, not one of RegexTag, Tag or And: " +
tagsFilter.asHumanString(false, false, {})
)
} }
return keyValues return keyValues
} }

View file

@ -357,6 +357,7 @@ class ListenerTracker<T> {
let toDelete = undefined let toDelete = undefined
let startTime = new Date().getTime() / 1000 let startTime = new Date().getTime() / 1000
for (const callback of this._callbacks) { for (const callback of this._callbacks) {
try {
if (callback(data) === true) { if (callback(data) === true) {
// This callback wants to be deleted // This callback wants to be deleted
// Note: it has to return precisely true in order to avoid accidental deletions // Note: it has to return precisely true in order to avoid accidental deletions
@ -366,6 +367,9 @@ class ListenerTracker<T> {
toDelete.push(callback) toDelete.push(callback)
} }
} }
} catch (e) {
console.error("Got an error while running a callback:", e)
}
} }
let endTime = new Date().getTime() / 1000 let endTime = new Date().getTime() / 1000
if (endTime - startTime > 500) { if (endTime - startTime > 500) {

View file

@ -54,6 +54,7 @@
if ( if (
confg.mappings?.length > 0 && confg.mappings?.length > 0 &&
confg.multiAnswer &&
(checkedMappings === undefined || (checkedMappings === undefined ||
checkedMappings?.length < confg.mappings.length + (confg.freeform ? 1 : 0)) checkedMappings?.length < confg.mappings.length + (confg.freeform ? 1 : 0))
) { ) {