reimplement the run method on the backup class

For some reason the BorgExceptions from the backup thread don't get caught in
the main_window. Therefore I'm implementing the error handling directly in the
class for the moment. This will have the side effect that the error dialog will
pop up when there is a problem during a background backup.

However that is anyway something I thought about implementing. This way it's
just not properly implemented yet.
This commit is contained in:
Andreas Zweili 2019-02-16 11:29:30 +01:00
parent 143f01d1e8
commit 3d222e3236
1 changed files with 10 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import json
from PyQt5.QtCore import QThread
from helper import BorgException
from helper import BorgException, show_error
class BorgQtThread(QThread):
@ -106,6 +106,15 @@ class BackupThread(BorgQtThread):
if self.excludes:
self.command.extend(self.excludes)
def run(self):
self.json_output, self.json_err = self.p.communicate()
self.p.wait()
try:
self.process_json_error(self.json_err)
except BorgException as e:
show_error(e)
self.stop()
def _process_prefix(self, prefix):
"""Prepares the prefix for the final command."""
if prefix: