Throws

Native
1.3
@Target([AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR]) annotation class Throws

This annotation indicates what exceptions should be declared by a function when compiled to a platform method.

When compiling to Objective-C/Swift framework, methods having or inheriting this annotation are represented as NSError*-producing methods in Objective-C and as throws methods in Swift. When such a method called through framework API throws an exception, it is either propagated as NSError or considered unhandled (if exception is kotlin.Error or kotlin.RuntimeException). In any case exception is not checked to be instance of one of the exceptionClasses.

Constructors

Native
1.3

<init>

This annotation indicates what exceptions should be declared by a function when compiled to a platform method.

Throws(vararg exceptionClasses: KClass<out Throwable>)

Properties

Native
1.3

exceptionClasses

the list of checked exception classes that may be thrown by the function.

vararg val exceptionClasses: Array<out KClass<out Throwable>>