自定义异常

This commit is contained in:
luming 2021-06-30 15:50:15 +08:00
parent 21fbc0eb17
commit 1dd7af534b

View File

@ -0,0 +1,9 @@
package senior.Exception
class RainException(override val message: String?) : Throwable() {
}
fun main(args: Array<String>) {
var name: String? = null
name?.length ?: throw RainException("rain自定义异常")
}