- } catch (ReadFailedException e) {
- assertNotNull("Expected a cause", e.getCause());
- Throwable cause;
- if (e.getCause().getCause() != null) {
- cause = e.getCause().getCause();
- } else {
- cause = e.getCause();
- }
-
- Throwables.propagateIfPossible(cause, Exception.class);
- throw new RuntimeException(cause);
+ } catch (ExecutionException e) {
+ final Throwable cause = e.getCause();
+ assertTrue("Unexpected cause: " + cause.getClass(), cause instanceof ReadFailedException);
+ throw Throwables.getRootCause(cause);