Skip to content

Instantly share code, notes, and snippets.

@damianh
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save damianh/29af723654339ecac118 to your computer and use it in GitHub Desktop.

Select an option

Save damianh/29af723654339ecac118 to your computer and use it in GitHub Desktop.
Simulating calling an async method in a catch block. < C# 6
Exception exception;
try
{
await Foo();
}
catch(Exception ex)
{
exception = ex;
}
if(exception != null)
{
await Bar();
ExceptionDispatchInfo.Capture(exception).Throw();
}
@damianh

damianh commented Aug 19, 2014

Copy link
Copy Markdown
Author

I hate this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment