Skip to content

Instantly share code, notes, and snippets.

@einarwh
Created Jun 30, 2014
Embed
What would you like to do?
Touch handler for exceptions.
public static Func<TR> Touch<TR, TE>(this Func<TR> f, Action<TE> h)
where TE : Exception
{
return () =>
{
try
{
return f();
}
catch (TE e)
{
h(e);
throw;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment