as Throwable
inline fun <T> T.asThrowable(fallbackMessage: (T) -> String = { "$it was converted into a Throwable!" }): Throwable
Converts any value of type T to a Throwable:
If the receiver is already a Throwable, it is returned as-is.
If the receiver implements ThrowableWrapper, its cause is returned.
If the receiver is
null, a NullPointerException is created using fallbackMessage.Otherwise, an IllegalStateException is created using fallbackMessage.
Return
Parameters
fallback Message
Produces the exception message from the receiver value. Defaults to a generic description. Only used when the receiver is not already a Throwable or ThrowableWrapper — in those cases the existing exception is returned as-is and this parameter is ignored.