@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR]) annotation class Throws
This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.
Example:
@Throws(IOException::class)
fun readFile(name: String): String {...}
will be translated to
String readFile(String name) throws IOException {...}
This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.
Throws(vararg exceptionClasses: KClass<out Throwable>)
the list of checked exception classes that may be thrown by the function.
vararg val exceptionClasses: Array<out KClass<out Throwable>>
© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-throws/index.html