Commit 3190a37
committed
Stop response-handler errors from poisoning the nREPL response queue
`nrepl-client-filter' decodes a batch of responses from the wire and
walks them in a `while' loop, dispatching each in turn. A demoted-
errors wrapper guarded the global `nrepl-response-handler-functions'
hook but stopped there -- the per-request `nrepl--dispatch-response'
call ran unprotected. If that call signaled (because of a buggy
callback, or because no handler was registered for the response's id),
the loop aborted and any later decoded responses sitting in the queue
were dropped.
Two changes:
- Wrap `nrepl--dispatch-response' in `with-demoted-errors' too.
Handler bugs are logged but no longer corrupt the response stream.
- Soften `nrepl--dispatch-response''s no-callback case from `error'
to `message'. The dispatcher cannot do anything actionable with an
unknown id; logging is sufficient.
Adds two specs in test/nrepl-client-tests.el covering the soft
no-handler path and locking in the dispatcher's "errors propagate
unless the filter wraps you" contract.1 parent 0ff2841 commit 3190a37
3 files changed
Lines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
286 | 290 | | |
287 | 291 | | |
288 | 292 | | |
| |||
294 | 298 | | |
295 | 299 | | |
296 | 300 | | |
297 | | - | |
| 301 | + | |
| 302 | + | |
298 | 303 | | |
299 | 304 | | |
300 | 305 | | |
301 | 306 | | |
302 | 307 | | |
303 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
304 | 314 | | |
305 | 315 | | |
306 | 316 | | |
307 | 317 | | |
308 | 318 | | |
309 | 319 | | |
310 | | - | |
| 320 | + | |
311 | 321 | | |
312 | 322 | | |
313 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
270 | 290 | | |
271 | 291 | | |
272 | 292 | | |
| |||
0 commit comments