mirror of
https://github.com/borgbase/vorta
synced 2024-12-22 15:57:34 +00:00
Improve exception handling. By @samuel-w (#628)
This commit is contained in:
parent
7bff91fd21
commit
d6f368ae50
1 changed files with 20 additions and 1 deletions
|
@ -5,13 +5,32 @@
|
|||
import peewee
|
||||
from vorta._version import __version__
|
||||
from vorta.config import SETTINGS_DIR
|
||||
from vorta.log import init_logger
|
||||
from vorta.log import init_logger, logger
|
||||
from vorta.models import init_db
|
||||
from vorta.updater import get_updater
|
||||
from vorta.utils import parse_args
|
||||
|
||||
|
||||
def main():
|
||||
def exception_handler(type, value, tb):
|
||||
from traceback import format_exception
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
logger.critical("Uncaught exception, file a report at https://github.com/borgbase/vorta/issues/new",
|
||||
exc_info=(type, value, tb))
|
||||
full_exception = ''.join(format_exception(type, value, tb))
|
||||
if app:
|
||||
QMessageBox.critical(None,
|
||||
app.tr("Fatal Error"),
|
||||
app.tr(
|
||||
"Uncaught exception, please file a report with this text at\n"
|
||||
"https://github.com/borgbase/vorta/issues/new\n") + full_exception)
|
||||
else:
|
||||
# Crashed before app startup, cannot translate
|
||||
sys.exit(1)
|
||||
|
||||
sys.excepthook = exception_handler
|
||||
app = None
|
||||
|
||||
args = parse_args()
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL) # catch ctrl-c and exit
|
||||
|
||||
|
|
Loading…
Reference in a new issue