Commit d14ef7b
Forward panic handler through FilterError/IgnoreError wrappers
`efStage` (the wrapper returned by `FilterError` and
`IgnoreError`) embeds the `Stage` interface, which only exposes
the four Stage methods. So when `Pipeline.Start()` checks
`if phs, ok := s.(StagePanicHandlerAware); ok`, the assertion
silently fails for any wrapped stage — even if the underlying
stage is a `goStage` that implements `SetPanicHandler`.
The result: a configured `WithStagePanicHandler` is bypassed
when the panicking Function is wrapped in `IgnoreError`. The
goroutine inside `goStage.Start` sees `panicHandler == nil`
and returns without calling `recover()`, letting the panic
propagate up the runtime and crash the host process.
This was a pre-existing bug in main (not introduced by the Stage
interface redesign), but we're already touching the panic-handler
surface to restore it for bare Function stages, so fix it in the
same series.
Implement `SetPanicHandler` on `efStage` and forward it to the
embedded stage if it implements `StagePanicHandlerAware`. Add a
`var _ StagePanicHandlerAware = efStage{}` compile-time
assertion and a regression test that wraps a panicking Function
in `IgnoreError` and verifies the handler runs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 8114965 commit d14ef7b
2 files changed
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
29 | 44 | | |
30 | 45 | | |
31 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
535 | 564 | | |
536 | 565 | | |
537 | 566 | | |
| |||
0 commit comments