« get me outta code hell

checks: check resolved mainReleaseTrack, too - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-10-02 20:46:56 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-02 20:47:13 -0300
commitbc5e4e37be8b66d99083f26ff0e8b79edf2aa663 (patch)
tree35b800832c2c1994197faed206b911f52cc32ad9 /src
parentca412ca52b1998fe715951309d3e0546560c2c58 (diff)
checks: check resolved mainReleaseTrack, too preview
Diffstat (limited to 'src')
-rw-r--r--src/data/checks.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index edfd7e5b..5688b979 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -379,8 +379,24 @@ export function filterReferenceErrors(wikiData, {
                     }
                   }
 
-                  if (track ?? album) {
-                    return track ?? album;
+                  if (track) {
+                    return track;
+                  }
+
+                  if (album) {
+                    // At this point verification depends on the thing itself,
+                    // which is currently in lexical scope, but if this code
+                    // gets refactored, there might be trouble here...
+
+                    if (thing.mainReleaseTrack === null) {
+                      throw new Error(
+                        `Matched album for reference "${ref}":\n` +
+                        `- ` + inspect(album) + `\n` +
+                        `...but none of its tracks automatically match this secondary release.\n` +
+                        `Please resolve by specifying the track here, instead of the album.`);
+                    } else {
+                      return album;
+                    }
                   }
 
                   const aggregateCause =