mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-09-28 07:24:04 +00:00
Expose all import/export errors to the user
This commit is contained in:
@@ -27,7 +27,6 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
|
||||
fun exportDatabase(preferences: SharedPreferences, file: StoredFileHelper) {
|
||||
file.create()
|
||||
ZipOutputStream(SharpOutputStream(file.stream).buffered()).use { outZip ->
|
||||
try {
|
||||
// add the database
|
||||
ZipHelper.addFileToZip(
|
||||
outZip,
|
||||
@@ -57,9 +56,6 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
|
||||
.`object`(preferences.all)
|
||||
.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()) {
|
||||
Log.e(TAG, "Unable to loadSerializedPrefs")
|
||||
throw IOException("Unable to commit loadSerializedPrefs")
|
||||
}
|
||||
}
|
||||
}.let { fileExists ->
|
||||
@@ -168,7 +164,7 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
|
||||
}
|
||||
|
||||
if (!editor.commit()) {
|
||||
Log.e(TAG, "Unable to loadJsonPrefs")
|
||||
throw IOException("Unable to commit loadJsonPrefs")
|
||||
}
|
||||
}.let { fileExists ->
|
||||
if (!fileExists) {
|
||||
|
Reference in New Issue
Block a user