1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-03-13 14:50:43 +08:00

Use runCatching

This commit is contained in:
Him188 2020-03-05 08:27:27 +08:00
parent 446bd67738
commit 6dc4a24d8c

View File

@ -155,14 +155,14 @@ object MiraiCoreLoader {
}.content }.content
} }
var stream = try { var stream = kotlin.runCatching {
MiraiConsole.logger("Downloading newest Protocol lib from Aliyun") MiraiConsole.logger("Downloading newest Protocol lib from Aliyun")
downloadRequest(lib_aliyun, version) downloadRequest(lib_aliyun, version)
} catch (ignored: Exception) { }.getOrElse {
try { kotlin.runCatching {
MiraiConsole.logger("Downloading newest Protocol lib from JCenter") MiraiConsole.logger("Downloading newest Protocol lib from JCenter")
downloadRequest(lib_jcenter, version) downloadRequest(lib_jcenter, version)
} catch (e: Exception) { }.getOrElse { e ->
MiraiConsole.logger("Failed to download Protocol lib, please seeking for help") MiraiConsole.logger("Failed to download Protocol lib, please seeking for help")
e.printStackTrace() e.printStackTrace()
MiraiConsole.logger("Failed to download Protocol lib, please seeking for help") MiraiConsole.logger("Failed to download Protocol lib, please seeking for help")