propagate If Possible
Propagates this exactly as-is, if and only if it is an instance of RuntimeException, Error, or X. Example usage:
try {
someMethodThatCouldThrowAnything()
} catch (e: IKnowWhatToDoWithThisException) {
handle(e)
} catch (t: Throwable) {
t.propagateIfPossible<OtherException>()
throw RuntimeException("unexpected", t)
}Content copied to clipboard