##// END OF EJS Templates
fixed: the error handler should not handle handlers errors
cin -
r197:86187b01c4e0 default
parent child
Show More
@@ -27,10 +27,8 namespace Implab {
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 }
@@ -55,8 +53,8 namespace Implab {
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 {
@@ -39,16 +39,14 namespace Implab {
39 if (m_success != null) {
39 if (m_success != null) {
40 try {
40 try {
41 m_success(result);
41 m_success(result);
42 } catch(Exception err) {
42 // Analysis disable once EmptyGeneralCatchClause
43 SignalError(err);
43 } catch {
44 }
44 }
45 } else if ((m_mask & PromiseEventType.Success) != 0 && m_handler != null) {
45 } else if ((m_mask & PromiseEventType.Success) != 0 && m_handler != null) {
46 try {
46 try {
47 m_handler();
47 m_handler();
48 } catch(Exception err) {
48 // Analysis disable once EmptyGeneralCatchClause
49 // avoid calling handler twice in case of error
49 } catch {
50 if (m_error != null)
51 SignalError(err);
52 }
50 }
53 }
51 }
54 }
52 }
@@ -73,8 +71,8 namespace Implab {
73 if (m_cancel != null) {
71 if (m_cancel != null) {
74 try {
72 try {
75 m_cancel(reason);
73 m_cancel(reason);
76 } catch (Exception err) {
74 // Analysis disable once EmptyGeneralCatchClause
77 SignalError(err);
75 } catch {
78 }
76 }
79 } else if ((m_mask & PromiseEventType.Cancelled) != 0 && m_handler != null) {
77 } else if ((m_mask & PromiseEventType.Cancelled) != 0 && m_handler != null) {
80 try {
78 try {
General Comments 0
You need to be logged in to leave comments. Login now