public void Run(Action action) { Action wrapper = () => { catcher.Run(action); }; //Invoke re-throws nested exception in caller thread //BeginInvoke throws nested exception in UI thread control.Invoke(wrapper); }
public void InstanceIgnoreTest() { var catcher = new Catcher(); catcher.Run( () => { throw new Exception("Error on Action!"); } ); }
public void InstanceHandleTest() { var exceptions = new List <Exception>(); var catcher = new Catcher( (ex) => { exceptions.Add(ex); throw new Exception("Error on Handler!"); } ); catcher.Run( () => { throw new Exception("Error on Action!"); } ); Assert.AreEqual(1, exceptions.Count); Assert.AreEqual("Error on Action!", exceptions[0].Message); }