Hi Ken,
It is always a good idea, and the developers responsability, to check for errors.
On a coroutine operation you should check for errors before yielding to the Coroutine consumer:
//////////////////////////////////////////////////////////////////////////////////////// private IEnumerable<INotifyCompleted> LoadTopCustomersCoroutine() {
var userId = CurrentUser.UserId;
var allCustOperation = Manager.Customers.ExecuteAsync();
// event handler var allCustOperation.Completed += (s1, args1) => { if (args1.HasError) HandleError(args1); };
yield return allCustOperation; // SUSPEND // more code }
////////////////////////////////////////////////////////////////////////////////////////
or
////////////////////////////////////////////////////////////////////////////////////////
private IEnumerable<INotifyCompleted> LoadTopCustomersCoroutine() {
var allCustOperation = Manager.Customers.ExecuteAsync( // Callback checks for error op => { if (op.HasError) HandleError(op); } );
yield return allCustOperation; // more code }
////////////////////////////////////////////////////////////////////////////////////////
If an error occurs, you can let the error bubble up to the outer Coroutine or you can take care of the exception and mark the error as handled:
op. http://drc.ideablade.com/ApiDocumentation/webframe.html?IdeaBlade.EntityModel~IdeaBlade.EntityModel.AsyncEventArgs~MarkErrorAsHandled.html - MarkErrorAsHandled ();
You will also find this information in our http://drc.ideablade.com/xwiki/bin/view/Documentation/Asynchronous-Coroutine-Errors - DevForce Resource Center .
Regards,
Silvio.
|