Skip to content

Commit

Permalink
Use initCause
Browse files Browse the repository at this point in the history
Summary:
Retain any original error by making it the cause of the final `UnsatisfiedLinkError`.

The class does not have a constructor for a cause. So use `initCause`.

Reviewed By: MatthewLangille, simpleton

Differential Revision: D21134144

fbshipit-source-id: b1f56487617beef052e5c5b132d0a47a3353b582
  • Loading branch information
agampe authored and facebook-github-bot committed Apr 20, 2020
1 parent 6e84a2d commit 30af7ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion java/com/facebook/soloader/SoLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,11 @@ private static void doLoadLibraryBySoName(
sb.append(" result: ").append(result);
final String message = sb.toString();
Log.e(TAG, message);
throw new UnsatisfiedLinkError(message);
UnsatisfiedLinkError err = new UnsatisfiedLinkError(message);
if (error != null) {
err.initCause(error);
}
throw err;
}
}
}
Expand Down

0 comments on commit 30af7ce

Please sign in to comment.