CopyableThrowable
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
}
Content copied to clipboard
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.