Skip to content

Instantly share code, notes, and snippets.

@hecres
Last active March 3, 2018 11:01
Show Gist options
  • Save hecres/1d0fbe3fafaef532f5fcd7e408b6bedd to your computer and use it in GitHub Desktop.
Save hecres/1d0fbe3fafaef532f5fcd7e408b6bedd to your computer and use it in GitHub Desktop.
UniRxへのExceptionDispatchInfo導入
// メソッドの場合
public void OnError(Exception error)
{
ExceptionDispatchInfo.Capture(error).Throw();
}
// Actionデリゲートの場合
public static readonly Action<Exception> Throw = ex => { ExceptionDispatchInfo.Capture(ex).Throw(); };
public static readonly Action<Exception, T> Throw = (ex, _) => { ExceptionDispatchInfo.Capture(ex).Throw(); };
public static readonly Action<Exception, T1, T2> Throw = (ex, _, __) => { ExceptionDispatchInfo.Capture(ex).Throw(); };
public static readonly Action<Exception, T1, T2, T3> Throw = (ex, _, __, ___) => { ExceptionDispatchInfo.Capture(ex).Throw(); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment