Skip to content

Instantly share code, notes, and snippets.

@thebeebs
Last active May 21, 2020 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebeebs/26f5df8b750bd80b63008369d9d5ec70 to your computer and use it in GitHub Desktop.
Save thebeebs/26f5df8b750bd80b63008369d9d5ec70 to your computer and use it in GitHub Desktop.
Embarrassing
private static async Task<T> WrapAsync<T>(Func<object[], object> target, object[] args, string name)
{
try
{
return await new ChaosWrap<InjectException>().Execute<T>(() => (Task<T>) target(args));
}
catch (Exception e)
{
Console.WriteLine($"Async method `{name}` throws {e.GetType()} exception.");
return default;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment