IdeaBlade.EntityModel.Compat Assembly > IdeaBlade.EntityModel Namespace > Coroutine Class : Fail Method |
'Declaration
Public Shared Function Fail( _ ByVal error As Exception, _ Optional ByVal isErrorHandled As Boolean, _ Optional ByVal cancelled As Boolean _ ) As CoroutineOperation
'Usage
Dim error As Exception Dim isErrorHandled As Boolean Dim cancelled As Boolean Dim value As CoroutineOperation value = Coroutine.Fail(error, isErrorHandled, cancelled)
public static CoroutineOperation Fail( Exception error, bool isErrorHandled, bool cancelled )
public void SampleCoroutineWithFail() { var op = Coroutine.Start(CoroutineWithFail); op.Completed += (s, e) => { if (e.HasError) { MessageBox.Show(e.Error.Message); } }; } public IEnumerable<INotifyCompleted> CoroutineWithFail() { // Do 1 operation yield return _entityManager.Customers.Take(3).ExecuteAsync(); // Let's fail now, why not? yield return Coroutine.Fail(new Exception("failed here"), true); // This operation will never be run because of the fail above. var op2 = _em1.Areas.Take(2).ExecuteAsync(); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2