public static GuardResult RunGuarded(Action actionToExecute, params ExceptionProcessor[] exceptionProcessors) { { Debug.Assert(actionToExecute != null, "The application method should not be null."); } var processor = new ExceptionHandler(exceptionProcessors); var result = GuardResult.None; ExceptionFilter.ExecuteWithFilter( () => { actionToExecute(); result = GuardResult.Success; }, e => { processor.OnException(e); result = GuardResult.Failure; }); return result; }
public void Attach() { var domain = AppDomain.CurrentDomain; var handler = new ExceptionHandler(null, null); domain.UnhandledException += (s, e) => handler.OnException(e.ExceptionObject as Exception); }