Result question getter criteria error handling

This commit is contained in:
mrfry 2022-05-15 11:42:50 +02:00
parent 1e0d3fe296
commit a19fe1236c

View file

@ -418,7 +418,7 @@
criteria: () => {
const firstChild =
document.getElementsByTagName('form')[1].childNodes[0].childNodes[0]
if (!firstChild || !firstChild.className.includes('informationitem')) {
if (!firstChild.className.includes('informationitem')) {
return false
}
const questionNodes = Array.from(
@ -758,7 +758,13 @@
let resultNodes
Object.keys(resultNodeVariants).some((key) => {
const variant = resultNodeVariants[key]
if (variant.criteria()) {
let criteriaPassed = false
try {
criteriaPassed = variant.criteria()
} catch (e) {
debugLog('Criteria check failed with error', e)
}
if (criteriaPassed) {
resultNodes = variant.getter()
if (resultNodes.length === 0) {
warn(