« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/html.js12
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;