« 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/things
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/things
parente3358d7c6993aa454019ebf58a53198b9e28087f (diff)
data: tweak track album messaging in errors/inspect
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/track.js13
1 files changed, 11 insertions, 2 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)})`);
     }