diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-02-15 06:06:52 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-02-15 06:06:52 +0000 |
| commit | a9e97b0d9ec375fdf1cc0706719dd8835f9d06f2 (patch) | |
| tree | 63a01fa44475c9b52b0ad6b10b0711201d558def /core/java/android/util | |
| parent | d1da52edb963f15184c1ce20bae6ab77e76fed12 (diff) | |
| parent | 5210e9447c9b3ad9e2e97cfefa0ce4b18da01734 (diff) | |
Merge "Couple fixes for M11nGestureHandler"
Diffstat (limited to 'core/java/android/util')
| -rw-r--r-- | core/java/android/util/ExceptionUtils.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/java/android/util/ExceptionUtils.java b/core/java/android/util/ExceptionUtils.java index da7387fcae70..1a397b39ef3c 100644 --- a/core/java/android/util/ExceptionUtils.java +++ b/core/java/android/util/ExceptionUtils.java @@ -86,4 +86,16 @@ public class ExceptionUtils { while (t.getCause() != null) t = t.getCause(); return t; } -} + + /** + * Appends {@code cause} at the end of the causal chain of {@code t} + * + * @return {@code t} for convenience + */ + public static @NonNull Throwable appendCause(@NonNull Throwable t, @Nullable Throwable cause) { + if (cause != null) { + getRootCause(t).initCause(cause); + } + return t; + } +}
\ No newline at end of file |
