From 19794ec27f2df2fbea6c945970df9ceb3502ceeb Mon Sep 17 00:00:00 2001 From: Piper Date: Sun, 16 Aug 2026 16:56:10 +0200 Subject: [PATCH] Add UNFORGIVING mode * This will explicitly throw errors instead of handling them through Event Listeners --- src/template/template-e6d.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/template/template-e6d.js b/src/template/template-e6d.js index 96919cb..fcfab92 100644 --- a/src/template/template-e6d.js +++ b/src/template/template-e6d.js @@ -4,11 +4,18 @@ class TemplateE6d extends HTMLTemplateElement { this.preprocessed = false; } + connectedCallback() { + this.unforgiving = this.hasAttribute(`data-e6d-unforgiving`); + } + dispatchError(type, detail) { const evtBroad = new CustomEvent(`e6d-error`, {detail,}); const evtSpecific = new CustomEvent(`e6d-error-${ type }`, {detail,}); this.dispatchEvent(evtBroad); this.dispatchEvent(evtSpecific); + if (this.unforgiving) { + throw new Error(`${ type }: ${ JSON.stringify(detail) }`); + } } preprocess() { @@ -122,9 +129,6 @@ class TemplateE6d extends HTMLTemplateElement { this.preprocessed = true; } - connectedCallback() { - } - bind(obj = {}) { this.preprocess(); @@ -194,7 +198,7 @@ class TemplateE6d extends HTMLTemplateElement { injectTarget.data = dataValue; } } - + return [templated, references,]; }