Mercurial > pub > ImplabNet
comparison Implab/AbstractPromise.cs @ 197:86187b01c4e0
fixed: the error handler should not handle handlers errors
author | cin |
---|---|
date | Thu, 01 Sep 2016 10:43:31 +0300 |
parents | 75103928da09 |
children | cbe10ac0731e |
comparison
equal
deleted
inserted
replaced
196:40d7fed4a09e | 197:86187b01c4e0 |
---|---|
25 | 25 |
26 public void SignalSuccess() { | 26 public void SignalSuccess() { |
27 if ((m_mask & PromiseEventType.Success) != 0 && m_handler != null) { | 27 if ((m_mask & PromiseEventType.Success) != 0 && m_handler != null) { |
28 try { | 28 try { |
29 m_handler(); | 29 m_handler(); |
30 } catch (Exception err) { | 30 // Analysis disable once EmptyGeneralCatchClause |
31 // avoid calling handler twice in case of error | 31 } catch { |
32 if (m_error != null) | |
33 SignalError(err); | |
34 } | 32 } |
35 } | 33 } |
36 } | 34 } |
37 | 35 |
38 public void SignalError(Exception err) { | 36 public void SignalError(Exception err) { |
53 | 51 |
54 public void SignalCancel(Exception reason) { | 52 public void SignalCancel(Exception reason) { |
55 if (m_cancel != null) { | 53 if (m_cancel != null) { |
56 try { | 54 try { |
57 m_cancel(reason); | 55 m_cancel(reason); |
58 } catch (Exception err) { | 56 // Analysis disable once EmptyGeneralCatchClause |
59 SignalError(err); | 57 } catch { |
60 } | 58 } |
61 } else if ( (m_mask & PromiseEventType.Cancelled) != 0 && m_handler != null) { | 59 } else if ( (m_mask & PromiseEventType.Cancelled) != 0 && m_handler != null) { |
62 try { | 60 try { |
63 m_handler(); | 61 m_handler(); |
64 // Analysis disable once EmptyGeneralCatchClause | 62 // Analysis disable once EmptyGeneralCatchClause |