comparison Implab/ActionChainTask.cs @ 196:40d7fed4a09e

fixed promise chaining behavior, the error handler doesn't handle result or cancellation handlers exceptions these exceptions are propagated to the next handlers.
author cin
date Mon, 29 Aug 2016 23:15:51 +0300
parents dd4a3590f9c6
children eee3e49dd1ff
comparison
equal deleted inserted replaced
193:0d69c0d6de0d 196:40d7fed4a09e
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, HandleCancelInternal); 24 p.On(SetResult, HandleErrorInternal, HandleCancelInternal);
25 CancellationRequested(p.Cancel); 25 CancellationRequested(p.Cancel);
26 } catch (OperationCanceledException reason){
27 HandleCancelInternal(reason);
28 } catch(Exception err) { 26 } catch(Exception err) {
29 HandleErrorInternal(err); 27 SetErrorInternal(err);
30 } 28 }
31 } 29 }
32 } 30 }
33 31
34 } 32 }