|
80 | 80 | return get('application', 'Project');
|
81 | 81 | });
|
82 | 82 |
|
| 83 | +// Allow Continue on Failure |
| 84 | +set('teams_failure_continue', false); |
| 85 | + |
83 | 86 | // Deploy message
|
84 | 87 | set('teams_text', '_{{user}}_ deploying `{{what}}` to *{{where}}*');
|
85 | 88 | set('teams_success_text', 'Deploy to *{{where}}* successful');
|
|
97 | 100 | return;
|
98 | 101 | }
|
99 | 102 |
|
100 |
| - Httpie::post(get('teams_webhook'))->jsonBody([ |
101 |
| - "themeColor" => get('teams_color'), |
102 |
| - 'text' => get('teams_text'), |
103 |
| - ])->send(); |
| 103 | + try { |
| 104 | + Httpie::post(get('teams_webhook'))->jsonBody([ |
| 105 | + "themeColor" => get('teams_color'), |
| 106 | + 'text' => get('teams_text'), |
| 107 | + ])->send(); |
| 108 | + } catch (\Exception $e) { |
| 109 | + if (get('teams_failure_continue', false)) { |
| 110 | + warning('Error sending Teams Notification: ' . $e->getMessage()); |
| 111 | + } else { |
| 112 | + throw $e; |
| 113 | + } |
| 114 | + } |
| 115 | + |
104 | 116 | })
|
105 | 117 | ->once()
|
106 | 118 | ->hidden();
|
|
112 | 124 | return;
|
113 | 125 | }
|
114 | 126 |
|
115 |
| - Httpie::post(get('teams_webhook'))->jsonBody([ |
116 |
| - "themeColor" => get('teams_success_color'), |
117 |
| - 'text' => get('teams_success_text'), |
118 |
| - ])->send(); |
| 127 | + try { |
| 128 | + Httpie::post(get('teams_webhook'))->jsonBody([ |
| 129 | + "themeColor" => get('teams_success_color'), |
| 130 | + 'text' => get('teams_success_text'), |
| 131 | + ])->send(); |
| 132 | + } catch (\Exception $e) { |
| 133 | + if (get('teams_failure_continue', false)) { |
| 134 | + warning('Error sending Teams Notification: ' . $e->getMessage()); |
| 135 | + } else { |
| 136 | + throw $e; |
| 137 | + } |
| 138 | + } |
119 | 139 | })
|
120 | 140 | ->once()
|
121 | 141 | ->hidden();
|
|
127 | 147 | return;
|
128 | 148 | }
|
129 | 149 |
|
130 |
| - Httpie::post(get('teams_webhook'))->jsonBody([ |
131 |
| - "themeColor" => get('teams_failure_color'), |
132 |
| - 'text' => get('teams_failure_text'), |
133 |
| - ])->send(); |
| 150 | + try { |
| 151 | + Httpie::post(get('teams_webhook'))->jsonBody([ |
| 152 | + "themeColor" => get('teams_failure_color'), |
| 153 | + 'text' => get('teams_failure_text'), |
| 154 | + ])->send(); |
| 155 | + } catch (\Exception $e) { |
| 156 | + if (get('teams_failure_continue', false)) { |
| 157 | + warning('Error sending Teams Notification: ' . $e->getMessage()); |
| 158 | + } else { |
| 159 | + throw $e; |
| 160 | + } |
| 161 | + } |
134 | 162 | })
|
135 | 163 | ->once()
|
136 | 164 | ->hidden();
|
0 commit comments