Skip to content

Commit

Permalink
Use loguru logging for caught exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusRendal authored and 1over137 committed Jan 28, 2024
1 parent 6d09f47 commit 8450599
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vocabsieve/uncaught_hook.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from PyQt5.QtCore import pyqtSignal, QObject
from PyQt5.QtWidgets import QMessageBox
import traceback
from loguru import logger
import sys

class ExceptionCatcher(QObject):
Expand All @@ -12,7 +13,7 @@ def __init__(self):
self.exception_signal.connect(self.make_error_box)

def make_error_box(self, e_type, e_value, e_trace):
traceback.print_exception(e_type, e_value, e_trace)
logger.error("".join(traceback.format_exception(e_type, e_value, e_trace)))
msg = QMessageBox()
msg.setIcon(QMessageBox.Icon.Critical)
msg.setText(traceback.format_exception_only(e_type, e_value)[-1])
Expand Down

0 comments on commit 8450599

Please sign in to comment.