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)
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.



Link copied to clipboard
abstract fun createCopy(): T?

Creates a copy of the current instance.