4 ms·
Exactly, same as panic! in Rust. There is a reason Rust was reluctant to add std::panic::catch_unwind at first. The docs thus explicitly mention that (1) it is
by lblume 2y ago
Exactly, same as panic! in Rust.
There is a reason Rust was reluctant to add std::panic::catch_unwind at first. The docs thus explicitly mention that (1) it is not a typical exception mechanism and (2) that it might not even catch panics if unwinding is disabled (common for embedded and restricted development).
- kmeisthax 2y agoAlso (3) there are panics that can't be safely caught, such as stack overflow.
- jub0bs 2y agoThere are even panics that are intended as irrecoverable: https://cs.opensource.google/go/x/sync/+/refs/tags/v0.12.0:singleflight/singleflight.go;l=167 https://cs.opensource.google/go/x/sync/+/refs/tags/v0.12.0:s...