W3cubDocs

/Kotlin

Throws

Platform and version requirements: 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

Platform and version requirements: 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

Platform and version requirements: 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>>

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native/-throws/index.html