« get me outta code hell

data, checks: don't let Main Release be secrelease's own album - 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:
author(quasar) nebula <qznebula@protonmail.com>2025-10-03 19:19:43 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-03 19:19:43 -0300
commit7ae1f20d46669be1e8354da1da83888de60814cc (patch)
treeabdea7f9ab9f713d418791b48d966c239213cfec /src/data/checks.js
parent590acab709aca1c9ded2feb6de8d170de554340b (diff)
data, checks: don't let Main Release be secrelease's own album
Diffstat (limited to 'src/data/checks.js')
-rw-r--r--src/data/checks.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index fb4a9673..de433de4 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -405,11 +405,20 @@ export function filterReferenceErrors(wikiData, {
                     // 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.`);
+                      if (album === thing.album) {
+                        throw new Error(
+                          `Matched album for reference "${ref}":\n` +
+                          `- ` + inspect(album) + `\n` +
+                          `...but this is the album that includes this secondary release, itself.\n` +
+                          `Please resolve by pointing to aonther album here, or by removing this\n` +
+                          `Main Release field, if this track is meant to be the main release.`);
+                      } else {
+                        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;
                     }