Expose all import/export errors to the user

This commit is contained in:
Stypox 2024-03-30 18:47:20 +01:00
parent 8e192acb63
commit 7da1d30010
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 27 additions and 31 deletions

View File

@ -27,7 +27,6 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
fun exportDatabase(preferences: SharedPreferences, file: StoredFileHelper) { fun exportDatabase(preferences: SharedPreferences, file: StoredFileHelper) {
file.create() file.create()
ZipOutputStream(SharpOutputStream(file.stream).buffered()).use { outZip -> ZipOutputStream(SharpOutputStream(file.stream).buffered()).use { outZip ->
try {
// add the database // add the database
ZipHelper.addFileToZip( ZipHelper.addFileToZip(
outZip, outZip,
@ -57,9 +56,6 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
.`object`(preferences.all) .`object`(preferences.all)
.done() .done()
} }
} catch (e: Exception) {
Log.e(TAG, "Unable to export serialized settings", e)
}
} }
} }
@ -133,7 +129,7 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
} }
if (!editor.commit()) { if (!editor.commit()) {
Log.e(TAG, "Unable to loadSerializedPrefs") throw IOException("Unable to commit loadSerializedPrefs")
} }
} }
}.let { fileExists -> }.let { fileExists ->
@ -168,7 +164,7 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
} }
if (!editor.commit()) { if (!editor.commit()) {
Log.e(TAG, "Unable to loadJsonPrefs") throw IOException("Unable to commit loadJsonPrefs")
} }
}.let { fileExists -> }.let { fileExists ->
if (!fileExists) { if (!fileExists) {