From d4e642ae830ceff6c16a9351c8c7bbc10839c187 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Fri, 8 Oct 2021 22:40:14 +0200 Subject: [PATCH] Generic error while unlock when WebDAV password changed (fixes #364) --- .../cloud/webdav/WebDavCloudContentRepository.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/data/src/main/java/org/cryptomator/data/cloud/webdav/WebDavCloudContentRepository.kt b/data/src/main/java/org/cryptomator/data/cloud/webdav/WebDavCloudContentRepository.kt index 304ffd3d..b0258418 100644 --- a/data/src/main/java/org/cryptomator/data/cloud/webdav/WebDavCloudContentRepository.kt +++ b/data/src/main/java/org/cryptomator/data/cloud/webdav/WebDavCloudContentRepository.kt @@ -198,12 +198,16 @@ internal class WebDavCloudContentRepository(private val cloud: WebDavCloud, conn try { webDavImpl.read(file, data, progressAware) } catch (e: BackendException) { - if (ExceptionUtil.contains(e, NotFoundException::class.java)) { - throw NoSuchCloudFileException(file.name) - } else if (e is IOException) { - throw FatalBackendException(e) - } else if (e is FatalBackendException) { - throw e + when { + ExceptionUtil.contains(e, NotFoundException::class.java) -> { + throw NoSuchCloudFileException(file.name) + } + e is IOException -> { + throw FatalBackendException(e) + } + else -> { + throw e + } } } catch (e: IOException) { if (ExceptionUtil.contains(e, NotFoundException::class.java)) {