Skip to content

Commit

Permalink
create a popup window with the BadgerRoutineError message
Browse files Browse the repository at this point in the history
  • Loading branch information
YektaY committed Oct 23, 2024
1 parent 7c53408 commit 2628538
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/badger/errors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from badger.gui.default.windows.expandable_message_box import ExpandableMessageBox
from PyQt5.QtWidgets import QMessageBox

class BadgerConfigError(Exception):
pass

Expand Down Expand Up @@ -59,4 +62,16 @@ class BadgerLoadConfigError(Exception):


class BadgerRoutineError(Exception):
pass
def __init__(self, message="", detailed_text=""):
super().__init__(message)
self.detailed_text = detailed_text
self.show_message_box()

def show_message_box(self):
"""
Method to create and display a popup window with the error message.
"""
error_message = str(self)
dialog = ExpandableMessageBox(text=error_message, detailedText=self.detailed_text)
dialog.setIcon(QMessageBox.Critical)
dialog.exec_()

0 comments on commit 2628538

Please sign in to comment.