##// END OF EJS Templates
Reworked cancelation handling, if the cancel handler isn't specified the OperationCanceledException will be handled by the error handler...
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

File last commit:

r140:f973c5df9972 v2
r187:dd4a3590f9c6 ref20160224
Show More
Extensions.cs
41 lines | 1.7 KiB | text/x-csharp | CSharpLexer
cin
Improved logging
r134 namespace Implab.Diagnostics {
cin
rewritten tracing
r92 public static class Extensions {
public static IPromise<T> EndLogicalOperation<T>(this IPromise<T> promise) {
Safe.ArgumentNotNull(promise, "promise");
var op = TraceContext.Instance.DetachLogicalOperation();
cin
Promises rewritten, added improved version of AsyncQueue
r119 return promise.On(
x => {
cin
minor fixes
r109 TraceContext.Instance.EnterLogicalOperation(op,true);
TraceLog.TraceInformation("promise = {0}", x);
TraceLog.EndLogicalOperation();
TraceContext.Instance.Leave();
},
err =>{
TraceContext.Instance.EnterLogicalOperation(op,true);
TraceLog.TraceError("promise died {0}", err);
TraceLog.EndLogicalOperation();
TraceContext.Instance.Leave();
},
cin
added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
r138 reason => {
cin
minor fixes
r109 TraceContext.Instance.EnterLogicalOperation(op,true);
cin
fixes
r140 TraceLog.TraceInformation("promise cancelled {0}", reason == null ? "<no-reason>" : reason.Message);
cin
minor fixes
r109 TraceLog.EndLogicalOperation();
TraceContext.Instance.Leave();
}
);
cin
rewritten tracing
r92 }
cin
minor fixes
r94
public static IPromise EndLogicalOperation(this IPromise promise) {
Safe.ArgumentNotNull(promise, "promise");
var op = TraceContext.Instance.DetachLogicalOperation();
cin
Promises rewritten, added improved version of AsyncQueue
r119 return promise.On(() => {
cin
minor fixes
r94 TraceContext.Instance.EnterLogicalOperation(op,true);
TraceLog.EndLogicalOperation();
TraceContext.Instance.Leave();
cin
Promises rewritten, added improved version of AsyncQueue
r119 }, PromiseEventType.All);
cin
minor fixes
r94 }
cin
rewritten tracing
r92 }
}