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",
tagsFilter
)
throw "Invalid type to FlattenMultiAnswer"
throw "Invalid type to FlattenMultiAnswer: key is a regex too"
}
const keystr = <string>key
if (keyValues[keystr] === undefined) {
@ -109,7 +109,10 @@ export class TagUtils {
}
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
}

View file

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

View file

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