Skip to content

Instantly share code, notes, and snippets.

@nathanchen
Created November 5, 2013 09:12
Show Gist options
  • Select an option

  • Save nathanchen/7316118 to your computer and use it in GitHub Desktop.

Select an option

Save nathanchen/7316118 to your computer and use it in GitHub Desktop.
throw exception in one go
public void runBare() throws Throwable {
Throwable exception = null;
setUp();
try {
runTest();
} catch (Throwable running) {
exception = running;
} finally {
try {
tearDown();
} catch (Throwable tearingDown) {
if (exception == null) exception = tearingDown;
}
}
if (exception != null) throw exception;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment