public void Execute(TInstance instance) { try { _activities.Execute(instance); } catch (Exception innerException) { string message = "{0} occurred while handling {1} during {2}" .FormatWith(innerException.GetType().ToShortTypeName(), _event.Name, _state.Name); throw new StateMachineWorkflowException(message, innerException); } }
public void Execute(TInstance instance) { while (true) { try { _activities.Execute(instance); return; } catch (Exception ex) { try { ExceptionHandlerResult result = _exceptionHandler.Handle(instance, _event, ex); if (result == ExceptionHandlerResult.Unhandled) { throw; } if (result == ExceptionHandlerResult.Return) { return; } } catch (Exception innerException) { string message = "{0} occurred while handling {1} during {2}" .FormatWith(innerException.GetType().ToShortTypeName(), _event.Name, _state.Name); throw new StateMachineWorkflowException(message, innerException); } } } }