Prevent crashes when backup fails to be restored

Also add a bit of logging so that we know what / how it went wrong
This commit is contained in:
Jaime van Kessel 2019-05-16 15:48:09 +02:00
parent 915e0e2047
commit 1c9eab6b2b

View file

@ -148,5 +148,9 @@ class Backup:
Logger.log("d", "Removing current data in location: %s", target_path)
Resources.factoryReset()
Logger.log("d", "Extracting backup to location: %s", target_path)
archive.extractall(target_path)
try:
archive.extractall(target_path)
except PermissionError:
Logger.logException("e", "Unable to extract the backup due to permission errors")
return False
return True