Mercurial > pub > ImplabNet
comparison Implab/PromiseT.cs @ 203:4d9830a9bbb8 v2
Added 'Fail' method to RunnableComponent which allows component to move from
Running to Failed state.
Added PollingComponent a timer based runnable component
More tests
Added FailPromise a thin class to wrap exceptions
Fixed error handling in SuccessPromise classes.
| author | cin |
|---|---|
| date | Tue, 18 Oct 2016 17:49:54 +0300 |
| parents | e03ccec4a08d |
| children |
comparison
equal
deleted
inserted
replaced
| 202:2651cb9a4250 | 203:4d9830a9bbb8 |
|---|---|
| 43 public static IPromise<T> FromResult(T value) { | 43 public static IPromise<T> FromResult(T value) { |
| 44 return new SuccessPromise<T>(value); | 44 return new SuccessPromise<T>(value); |
| 45 } | 45 } |
| 46 | 46 |
| 47 public static IPromise<T> FromException(Exception error) { | 47 public static IPromise<T> FromException(Exception error) { |
| 48 var p = new Promise<T>(); | 48 return new FailedPromise<T>(error); |
| 49 p.Reject(error); | |
| 50 return p; | |
| 51 } | 49 } |
| 52 | 50 |
| 53 public virtual void Resolve(T value) { | 51 public virtual void Resolve(T value) { |
| 54 SetResult(value); | 52 SetResult(value); |
| 55 } | 53 } |
