« get me outta code hell

data: tweak track album messaging in errors/inspect - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-28 13:04:32 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-28 13:04:32 -0400
commit084b5423d2a4fc60a91dd4aeb24ff0cd4d870fbc (patch)
treee7afeb209061ffa8d2a7e259ed21173e8d735dae /src/data
parente3358d7c6993aa454019ebf58a53198b9e28087f (diff)
data: tweak track album messaging in errors/inspect
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/track.js13
-rw-r--r--src/data/yaml.js3
2 files changed, 12 insertions, 4 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index f6320677..d25213c2 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -331,12 +331,21 @@ export class Track extends Thing {
     }
 
     let album;
-    if (depth >= 0 && (album = this.album ?? this.dataSourceAlbum)) {
+
+    if (depth >= 0) {
+      try {
+        album = this.album;
+      } catch (_error) {}
+
+      album ??= this.dataSourceAlbum;
+    }
+
+    if (album) {
       const albumName = album.name;
       const albumIndex = album.tracks.indexOf(this);
       const trackNum =
         (albumIndex === -1
-          ? '#?'
+          ? 'indeterminate position'
           : `#${albumIndex + 1}`);
       parts.push(` (${colors.yellow(trackNum)} in ${colors.green(albumName)})`);
     }
diff --git a/src/data/yaml.js b/src/data/yaml.js
index dda06949..27d8721f 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -1625,8 +1625,7 @@ export function filterDuplicateDirectories(wikiData) {
         call(() => {
           throw new Error(
             `Duplicate directory ${colors.green(directory)}:\n` +
-              places.map((thing) => ` - ` + inspect(thing)).join('\n')
-          );
+            places.map(thing => ` - ` + inspect(thing)).join('\n'));
         });
       }