Commit d6c9b935 authored by Him188's avatar Him188

Catch exceptions

parent 002136ee
......@@ -72,9 +72,12 @@ suspend fun main() {
val image: Image by message
// 等同于 val image = message[Image]
reply(image + " downloading")
try {
image.downloadTo(newTestTempFile(suffix = ".png").also { reply("Temp file: ${it.absolutePath}") })
reply(image.id.value + " downloaded")
} catch (e: Exception) {
reply(e.message ?: e::class.java.simpleName)
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment