Last active
August 29, 2015 14:05
-
-
Save damianh/29af723654339ecac118 to your computer and use it in GitHub Desktop.
Simulating calling an async method in a catch block. < C# 6
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
| Exception exception; | |
| try | |
| { | |
| await Foo(); | |
| } | |
| catch(Exception ex) | |
| { | |
| exception = ex; | |
| } | |
| if(exception != null) | |
| { | |
| await Bar(); | |
| ExceptionDispatchInfo.Capture(exception).Throw(); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I hate this