From 64af929cf1d0bbae293d137044ddcd1cdb9cf492 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Wed, 4 Mar 2020 03:49:37 -0600
Subject: [PATCH] Better validation exceptions

---
 badwitch.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/badwitch.py b/badwitch.py
index 2f39d8c..0ed90f8 100755
--- a/badwitch.py
+++ b/badwitch.py
@@ -47,11 +47,9 @@ class Library:
         try:
             for album, albumcontent in self.albums.items():
                 for song, songcontent in albumcontent.items():
-                    if songcontent['artist'] is None:
-                        raise Exception
-        except:
-            logging.warn('Library not valid')
-            raise Exception('Library not valid')
+                    for field in ['track', 'artist', 'source']:
+                        if field not in songcontent:
+                            raise Exception('Song is missing required field', song, field)
 
     # Download library
     def download(self, targetalbum=None):