copyForStackTraceRecovery
Creates a copy of this for stacktrace recovery.
For better debuggability, it is recommended to use original exception as the cause of the resulting one. The stack trace of the copied exception will be overwritten by stacktrace recovery machinery using the Throwable.setStackTrace call.
An exception can opt-out of copying by returning null from this function.
Suppressed exceptions of the original exception should be left uncopied, to avoid circular exceptions.
This function may create a copy with a modified message, but note that the copy can be later recovered as well, so the message modification code should handle this situation correctly (e.g. by also storing the original message and checking it) to produce a human-readable result.