diff options
-rw-r--r-- | src/util/html.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/html.js b/src/util/html.js index 16da6d73..06afbb4f 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -404,7 +404,17 @@ export class Tag { let content = ''; for (const [index, item] of this.content.entries()) { - const itemContent = item.toString(); + let itemContent; + + try { + itemContent = item.toString(); + } catch (caughtError) { + throw new Error( + `Error stringifying child #${index + 1} ` + + `of ${inspect(this, {compact: true})}: ` + + inspect(item, {compact: true}), + {cause: caughtError}); + } if (!itemContent) { continue; |