comparison Implab/ActionChainTask.cs @ 187:dd4a3590f9c6 ref20160224

Reworked cancelation handling, if the cancel handler isn't specified the OperationCanceledException will be handled by the error handler Any unhandled OperationCanceledException will cause the promise cancelation
author cin
date Tue, 19 Apr 2016 17:35:20 +0300
parents 822aab37b107
children 40d7fed4a09e
comparison
equal deleted inserted replaced
186:75103928da09 187:dd4a3590f9c6
19 19
20 public void Resolve() { 20 public void Resolve() {
21 if (m_task != null && LockCancelation()) { 21 if (m_task != null && LockCancelation()) {
22 try { 22 try {
23 var p = m_task(); 23 var p = m_task();
24 p.On(SetResult, HandleErrorInternal, SetCancelled); 24 p.On(SetResult, HandleErrorInternal, HandleCancelInternal);
25 CancellationRequested(p.Cancel); 25 CancellationRequested(p.Cancel);
26 } catch (OperationCanceledException reason){
27 HandleCancelInternal(reason);
26 } catch(Exception err) { 28 } catch(Exception err) {
27 HandleErrorInternal(err); 29 HandleErrorInternal(err);
28 } 30 }
29 } 31 }
30 } 32 }