« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/checks.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/checks.js')
-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 =