From 40d0c09ea64a6e0d3bd93e902a14218a96e95933 Mon Sep 17 00:00:00 2001
From: "(quasar) nebula" <qznebula@protonmail.com>
Date: Sat, 1 Jan 2022 16:07:48 -0400
Subject: more useful error when album missing Name field

---
 src/upd8.js | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src')

diff --git a/src/upd8.js b/src/upd8.js
index c9fc1d87..08365c11 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -782,6 +782,11 @@ async function processAlbumDataFile(file) {
     const album = {};
 
     album.name = getBasicField(albumSection, 'Album');
+
+    if (!album.name) {
+        return {error: `The file "${path.relative(dataPath, file)}" is missing the "Album" field - maybe this is a misplaced file instead of album data?`};
+    }
+
     album.artists = getContributionField(albumSection, 'Artists') || getContributionField(albumSection, 'Artist');
     album.wallpaperArtists = getContributionField(albumSection, 'Wallpaper Art');
     album.wallpaperStyle = getMultilineField(albumSection, 'Wallpaper Style');
-- 
cgit 1.3.0-6-gf8a5