diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-12-31 22:52:00 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-01-03 20:45:45 -0400 |
commit | a98f2af3d08c5566c188a79bc75c7168d2b555be (patch) | |
tree | 3044837278ec4dff8c689f9741136af72776f481 /src | |
parent | 1a62a7345b73fbf31b084577ae78379dc1585813 (diff) |
html: trace line where tag is created
Diffstat (limited to 'src')
-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) { |