Report a backup folder that names no tree as unavailable, not as a failed write (#77)
This commit is contained in:
1 parent
e1097e9093
commit
9cb5ad2942
1 file changed
+9
-2
@@ -199,8 +199,15 @@ class ExportWriter @Inject constructor(
|
||||
}.orEmpty()
|
||||
}
|
||||
|
||||
private fun openTree(treeUri: Uri): DocumentFile =
|
||||
DocumentFile.fromTreeUri(context, treeUri) ?: throw ExportFailedException(ExportFailure.FOLDER_UNAVAILABLE)
|
||||
/** [treeUri]'s folder; one that names no tree is as unavailable as a folder that is gone. */
|
||||
private fun openTree(treeUri: Uri): DocumentFile {
|
||||
val tree = try {
|
||||
DocumentFile.fromTreeUri(context, treeUri)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
throw ExportFailedException(ExportFailure.FOLDER_UNAVAILABLE, e)
|
||||
}
|
||||
return tree ?: throw ExportFailedException(ExportFailure.FOLDER_UNAVAILABLE)
|
||||
}
|
||||
|
||||
/**
|
||||
* [cause], a write into [tree] that failed, told apart by asking the folder
|
||||
|
||||
Reference in new issue
Block a user