Fix capture database exception

This commit is contained in:
J-Jamet committed 2022-05-19 21:22:13 +02:00
1 parent cfcb49e233
commit 1ff2f501ca
2 files changed
+12 -4

No files matched your search

@@ -22,10 +22,10 @@ package com.kunzisoft.keepass.database.action
import android.content.Context
import android.net.Uri
import com.kunzisoft.keepass.database.element.Database
import com.kunzisoft.keepass.database.element.binary.BinaryData
import com.kunzisoft.keepass.database.exception.DatabaseInputException
import com.kunzisoft.keepass.hardware.HardwareKey
import com.kunzisoft.keepass.database.element.MainCredential
import com.kunzisoft.keepass.database.element.binary.BinaryData
import com.kunzisoft.keepass.database.exception.DatabaseException
import com.kunzisoft.keepass.hardware.HardwareKey
import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.tasks.ActionRunnable
import com.kunzisoft.keepass.tasks.ProgressTaskUpdater
@@ -55,7 +55,7 @@ class MergeDatabaseRunnable(private val context: Context,
},
progressTaskUpdater
)
} catch (e: DatabaseInputException) {
} catch (e: DatabaseException) {
setError(e)
}
@@ -621,6 +621,8 @@ class Database {
loaded = true
} catch (e: Exception) {
Log.e(TAG, "Unable to load the database")
if (e is DatabaseInputException)
throw e
throw DatabaseInputException(e)
} finally {
dataModifiedSinceLastLoading = false
@@ -715,6 +717,8 @@ class Database {
}
} catch (e: Exception) {
Log.e(TAG, "Unable to merge the database")
if (e is DatabaseException)
throw e
throw DatabaseInputException(e)
} finally {
databaseToMerge.clearAndClose()
@@ -768,6 +772,8 @@ class Database {
}
} catch (e: Exception) {
Log.e(TAG, "Unable to reload the database")
if (e is DatabaseException)
throw e
throw DatabaseInputException(e)
} finally {
dataModifiedSinceLastLoading = false
@@ -862,6 +868,8 @@ class Database {
}
} catch (e: Exception) {
Log.e(TAG, "Unable to save database", e)
if (e is DatabaseException)
throw e
throw DatabaseOutputException(e)
} finally {
if (databaseCopyUri == null) {