diff options
-rw-r--r-- | src/util/html.js | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/util/html.js b/src/util/html.js index 2229394d..69819669 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -194,10 +194,14 @@ export class Tag { #content = null; #attributes = null; + #traceError = null; + constructor(tagName, attributes, content) { this.tagName = tagName; this.attributes = attributes; this.content = content; + + this.#traceError = new Error(); } clone() { @@ -430,10 +434,26 @@ export class Tag { itemContent = item.toString(); } catch (caughtError) { const indexPart = colors.yellow(`child #${index + 1}`); - throw new Error( - `Error in ${indexPart} ` + - `of ${inspect(this, {compact: true})}`, - {cause: caughtError}); + + const error = + new Error( + `Error in ${indexPart} ` + + `of ${inspect(this, {compact: true})}`, + {cause: caughtError}); + + error[Symbol.for(`hsmusic.aggregate.alwaysTrace`)] = true; + error[Symbol.for(`hsmusic.aggregate.traceFrom`)] = this.#traceError; + + error[Symbol.for(`hsmusic.aggregate.unhelpfulTraceLines`)] = [ + /content-function\.js/, + /util\/html\.js/, + ]; + + error[Symbol.for(`hsmusic.aggregate.helpfulTraceLines`)] = [ + /content\/dependencies\/(.*\.js:.*(?=\)))/, + ]; + + throw error; } if (!itemContent) { |