Repository navigation
Commit f24b691
committed
fix: handle request errors when fetching CODEOWNERS
getCodeOwnersFile() listened for an 'err' event on the https request,
which ClientRequest never emits; failures are emitted as 'error'. Any
network-level failure (DNS, ECONNRESET, socket hang up, TLS) therefore
had no listener, was thrown as an uncaught exception and terminated the
bot through the uncaughtException handler in server.js, instead of
rejecting the promise and letting the surrounding Aigle.retry() retry.
Listen for 'error' on the request, also reject on errors emitted by the
response stream (e.g. a connection dropped mid-body), and drain the
body of non-200 responses so the socket is released.
Add a unit test that makes the request fail at the network level and
expects getCodeOwnersFile() to reject; it fails with an uncaught
exception without this change.
Fixes: #705
Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>1 parent 2723715 commit f24b691
2 files changed
Lines changed: 29 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
| |||
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
130 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
172 | 194 | | |
173 | 195 | | |
174 | 196 | | |
| |||
0 commit comments