Commit 653a13a
authored
Prevent session errors from swallowing API error responses (#2059)
Why is this change needed?
Prior to this change, ErrorReporter::reportError() only wrapped its
call to storeSessionFeedback() in a finally block, not a catch. On
stateless routes (e.g. the /api/connections metadata push endpoint),
starting the native PHP session while storing feedback info can fail
(e.g. "headers already sent"). That failure propagated out of
reportError(), out of the calling exception listener, and skipped
$event->setResponse() in ApiHttpExceptionListener — so the intended
400/500 JSON error response for a failed push was never set and the
client received an HTTP 200 instead.
How does it address the issue?
This change adds a catch (Throwable) around storeSessionFeedback(),
logging the secondary failure as a warning instead of letting it
escape. reportError() can no longer throw, so every exception
listener that calls it (API, feedback page, fallback) reliably
finishes and sets its intended error response.
#20511 parent 49265fd commit 653a13a
2 files changed
Lines changed: 17 additions & 0 deletions
File tree
- src/OpenConext/EngineBlockBridge
- tests/unit/OpenConext/EngineBlockBridge
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
145 | 157 | | |
0 commit comments