Add debug message and better error handling for buy list dialog

This commit is contained in:
nmemmert committed 2025-11-17 11:39:52 -05:00
1 parent 3f377e165d
commit 2da02dc7df
1 file changed
+7
+7
View File
@@ -454,13 +454,18 @@ class MainWindow(QMainWindow):
def show_buy_list(self): def show_buy_list(self):
"""Show the Amazon buy list dialog with interactive features""" """Show the Amazon buy list dialog with interactive features"""
QMessageBox.information(self, "Debug", "Show buy list called")
try: try:
with open('amazon_buy_list.txt', 'r') as f: with open('amazon_buy_list.txt', 'r') as f:
content = f.read() content = f.read()
except FileNotFoundError: except FileNotFoundError:
QMessageBox.information(self, "No Buy List", "No buy list available. Run an update to generate the list.") QMessageBox.information(self, "No Buy List", "No buy list available. Run an update to generate the list.")
return return
except Exception as e:
QMessageBox.critical(self, "Error", f"Failed to read buy list file: {e}")
return
try:
# Parse content to get songs # Parse content to get songs
lines = content.split('\n') lines = content.split('\n')
songs = [] songs = []
@@ -522,6 +527,8 @@ class MainWindow(QMainWindow):
dialog.raise_() dialog.raise_()
dialog.activateWindow() dialog.activateWindow()
dialog.exec() dialog.exec()
except Exception as e:
QMessageBox.critical(self, "Error", f"Failed to show buy list dialog: {e}")
def populate_buy_list(self, songs): def populate_buy_list(self, songs):
"""Populate the buy list widget""" """Populate the buy list widget"""