T-Spoon / Traceur

Easier RxJava2 debugging with better stacktraces
489 stars 28 forks source link

Fix crash when throwable cause is already initialized #9

Closed jonnyandrew closed 4 years ago

jonnyandrew commented 6 years ago

Issue

When trying to append a TraceurException to a throwable which has already had it's cause initialised, an exception is thrown. See https://github.com/T-Spoon/Traceur/issues/7

Resolution

In this case, theres not much we can do to resolve the issue because Throwable#initCause is not designed to be called twice. So the fix in this PR uses the same logic as the RxJava2Extensions project by catching any exception and continuing. See https://github.com/akarnokd/RxJava2Extensions/blob/2ec72c9a317da02717d207f876ca5ba43768d802/src/main/java/hu/akarnokd/rxjava2/debug/RxJavaAssemblyException.java#L129