Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun Throwable.lastCause(): Throwable {
- val dejaVu = Collections.newSetFromMap(IdentityHashMap<Throwable, Boolean>())
- dejaVu.add(this)
- var curThrowable = this
- while (curThrowable.cause != null && !dejaVu.contains(curThrowable.cause)) {
- curThrowable = curThrowable.cause!!
- dejaVu.add(curThrowable)
- }
- return curThrowable
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement