error

fun error(message: String): Nothing(source)

Stops normal execution by throwing an IllegalStateException.

The return type Nothing allows this call in any expression that needs a value.

val value = candidate ?: error("Missing value")

Parameters

message

description of the invalid state.

Throws

always, with message as its detail message.