##// END OF EJS Templates
fixed promise chaining behavior, the error handler doesn't handle result or cancellation handlers exceptions these exceptions are propagated to the next handlers.
fixed promise chaining behavior, the error handler doesn't handle result or cancellation handlers exceptions these exceptions are propagated to the next handlers.

File last commit:

r140:f973c5df9972 v2
r196:40d7fed4a09e default
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 }
}