CopyableThrowable

interface CopyableThrowable<T : Throwable, CopyableThrowable<T>>

Throwable which can be cloned during stacktrace recovery in a class-specific way. For additional information about stacktrace recovery see STACKTRACE_RECOVERY_PROPERTY_NAME

Example of usage:

class BadResponseCodeException(val responseCode: Int) : Exception(), CopyableThrowable<BadResponseCodeException> {

override fun createCopy(): BadResponseCodeException {
val result = BadResponseCodeException(responseCode)
result.initCause(this)
return result
}

Copy mechanism is used only on JVM, but it might be convenient to implement it in common exceptions, so on JVM their stacktraces will be properly recovered.

Functions

createCopy
Link copied to clipboard
common
abstract fun createCopy(): T?
Creates a copy of the current instance.

Inheritors

TimeoutCancellationException
Link copied to clipboard

Sources

common source
Link copied to clipboard