comparison Implab/FailedPromiseT.cs @ 242:cbe10ac0731e v3

Working on promises
author cin
date Wed, 24 Jan 2018 03:03:21 +0300
parents 4d9830a9bbb8
children
comparison
equal deleted inserted replaced
240:fa6cbf4d8841 242:cbe10ac0731e
7 } 7 }
8 8
9 public IPromise<T> On(Action<T> success, Action<Exception> error, Action<Exception> cancel) { 9 public IPromise<T> On(Action<T> success, Action<Exception> error, Action<Exception> cancel) {
10 if (error != null) { 10 if (error != null) {
11 try { 11 try {
12 error(Error); 12 error(RejectReason);
13 // Analysis disable once EmptyGeneralCatchClause 13 // Analysis disable once EmptyGeneralCatchClause
14 } catch { 14 } catch {
15 } 15 }
16 } 16 }
17 return this; 17 return this;
18 } 18 }
19 19
20 public IPromise<T> On(Action<T> success, Action<Exception> error) { 20 public IPromise<T> On(Action<T> success, Action<Exception> error) {
21 if (error != null) { 21 if (error != null) {
22 try { 22 try {
23 error(Error); 23 error(RejectReason);
24 // Analysis disable once EmptyGeneralCatchClause 24 // Analysis disable once EmptyGeneralCatchClause
25 } catch { 25 } catch {
26 } 26 }
27 } 27 }
28 return this; 28 return this;
31 public IPromise<T> On(Action<T> success) { 31 public IPromise<T> On(Action<T> success) {
32 return this; 32 return this;
33 } 33 }
34 34
35 T IPromise<T>.Join() { 35 T IPromise<T>.Join() {
36 throw new TargetInvocationException(Error); 36 throw new TargetInvocationException(RejectReason);
37 } 37 }
38 38
39 T IPromise<T>.Join(int timeout) { 39 T IPromise<T>.Join(int timeout) {
40 throw new TargetInvocationException(Error); 40 throw new TargetInvocationException(RejectReason);
41 } 41 }
42 42
43 43
44 IPromise<T> IPromise<T>.On(Action success, Action<Exception> error, Action<Exception> cancel) { 44 IPromise<T> IPromise<T>.On(Action success, Action<Exception> error, Action<Exception> cancel) {
45 On(success, error, cancel); 45 On(success, error, cancel);