Created
November 5, 2013 09:12
-
-
Save nathanchen/7316118 to your computer and use it in GitHub Desktop.
throw exception in one go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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