From cf29deaa0cf6fa4dc600c0684b009f4ec02ce5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Mon, 23 Oct 2017 23:48:49 +0200 Subject: [PATCH] fix broken logic in err reporting --- js/appcommon.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/appcommon.js b/js/appcommon.js index 81229d3..906e5a2 100644 --- a/js/appcommon.js +++ b/js/appcommon.js @@ -100,14 +100,16 @@ $.ready(function () { let errs = decodeURIComponent(window.location.search.substr(msgAt + 4)).split(',') let humanReadableErrors = [] errs.forEach(function (er) { + if (er.length === 0) return let lbls = qsa('label[for="' + er + '"]') - if (lbls) { + if (lbls && lbls.length > 0) { for (let i = 0; i < lbls.length; i++) { let lbl = lbls[i] lbl.classList.add('error') if (i === 0) humanReadableErrors.push(lbl.childNodes[0].textContent.trim().replace(/: ?$/, '')) } } else { + console.log(JSON.stringify(er)) humanReadableErrors.push(er) } })