Commit 3edbe8f
committed
Merge #268: Use throwRecoverableException instead of raw throw for stored exceptions
23be44b Use throwRecoverableException instead of raw throw for stored exceptions (Alfonso Roman Zubeldia)
Pull request description:
Replace `throw kj::mv(*exception)` with `kj::throwRecoverableException(kj::mv(*exception))` in the async worker thread exception handler in `type-context.h`.
A raw throw creates a `kj::Exception` with the calling binary's typeinfo. On macOS with `-fvisibility=hidden`, this typeinfo is not coalesced with `libkj.dylib`'s copy by the dynamic linker, so `getCaughtExceptionAsKj()`'s `catch (kj::Exception& e)` fails and falls through to `catch (...)`, producing `unknown non-KJ exception of type: kj::Exception` errors.
`throwFatalException()` routes the throw through libkj, wrapping it in `ExceptionImpl` with consistent typeinfo. This matches the pattern KJ uses internally in `kj/async-inl.h` when re-throwing stored exceptions from promises.
Context: bitcoin/bitcoin#34723, bitcoin/bitcoin#35014
ACKs for top commit:
Sjors:
ACK 23be44b
ryanofsky:
Code review ACK 23be44b. Thanks for the fix!
Tree-SHA512: b23e43b188255e76c499376f30e09db0868ab0dcc7fa4bd0b0f1ed38ab719d1c0a5e4a6cf7e2eb598a55ebdd0c28dda50623bdbf003ff56c3b6483ba1db916ee1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
0 commit comments