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,]; }