From 3f69b3533a3f780ef565bc061fe1dac64360a0eb Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 27 Apr 2022 09:40:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/storage/Backup.kt | 3 +++ app/src/main/java/io/legado/app/lib/webdav/WebDav.kt | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/storage/Backup.kt b/app/src/main/java/io/legado/app/help/storage/Backup.kt index 115bb36a2..090971514 100644 --- a/app/src/main/java/io/legado/app/help/storage/Backup.kt +++ b/app/src/main/java/io/legado/app/help/storage/Backup.kt @@ -3,6 +3,7 @@ package io.legado.app.help.storage import android.content.Context import android.net.Uri import androidx.documentfile.provider.DocumentFile +import io.legado.app.constant.AppLog import io.legado.app.constant.PreferKey import io.legado.app.data.appDb import io.legado.app.help.config.ReadBookConfig @@ -54,6 +55,8 @@ object Backup { } else { context.putPrefLong(PreferKey.lastBackup, System.currentTimeMillis()) } + }.onError { + AppLog.put("自动备份失败\n${it.localizedMessage}") } } } diff --git a/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt b/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt index b6678de60..1849355aa 100644 --- a/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt +++ b/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt @@ -214,9 +214,7 @@ class WebDav(urlStr: String, val authorization: Authorization) { checkResult(it) } }.onFailure { - val message = "WebDav上传失败\n${it.localizedMessage}" - AppLog.put(message) - throw NoStackTraceException(message) + throw NoStackTraceException("WebDav上传失败\n${it.localizedMessage}") } } @@ -234,9 +232,7 @@ class WebDav(urlStr: String, val authorization: Authorization) { checkResult(it) } }.onFailure { - val message = "WebDav上传失败\n${it.localizedMessage}" - AppLog.put(message) - throw NoStackTraceException(message) + throw NoStackTraceException("WebDav上传失败\n${it.localizedMessage}") } }