ensureInstanceOf

inline fun <Value, IsType : Any, Error> RaiseScope<Error>.ensureInstanceOf(check: Value, isType: KClass<IsType>, error: (Value) -> Error = { @Suppress(names = ["UNCHECKED_CAST"]) (it as Error) }): IsType

Returns check cast to IsType if it is an instance of that type, otherwise raises the Error produced by error.

Parameters

Value

The input value type.

IsType

The expected type to cast to.

Error

The error type.