comparison Implab/Promise.cs @ 112:38d6a4db35d7 v2

fixed Promise.Error handler
author cin
date Wed, 19 Nov 2014 13:34:09 +0300
parents f5220e5472ef
children 2573b562e328
comparison
equal deleted inserted replaced
110:1a8426e6e895 112:38d6a4db35d7
176 public Promise() { 176 public Promise() {
177 } 177 }
178 178
179 public Promise(IPromise parent) { 179 public Promise(IPromise parent) {
180 if (parent != null) 180 if (parent != null)
181 AddMappers<T>( 181 AddHandler(
182 null, 182 null,
183 null, 183 null,
184 () => { 184 () => {
185 if (parent.IsExclusive) 185 if (parent.IsExclusive)
186 parent.Cancel(); 186 parent.Cancel();
333 return this; 333 return this;
334 334
335 var medium = new Promise<T>(this); 335 var medium = new Promise<T>(this);
336 336
337 AddMappers( 337 AddMappers(
338 null, 338 x => x,
339 e => { 339 e => {
340 error(e); 340 error(e);
341 return default(T); 341 return default(T);
342 }, 342 },
343 null, 343 null,
360 if (handler == null) 360 if (handler == null)
361 return this; 361 return this;
362 362
363 var medium = new Promise<T>(this); 363 var medium = new Promise<T>(this);
364 364
365 AddMappers(null, handler, null, medium, true); 365 AddMappers(x => x, handler, null, medium, true);
366 366
367 return medium; 367 return medium;
368 } 368 }
369 369
370 /// <summary> 370 /// <summary>