3 ms·
You aren't. They're only caught in special cases, e.g. if a thread panics and you want to propagate that to other threads, to catch panics in unit tests, to avo
by IshKebab 3y ago
You aren't. They're only caught in special cases, e.g. if a thread panics and you want to propagate that to other threads, to catch panics in unit tests, to avoid unwinding across FFI, etc.
You shouldn't use them as a general exception mechanism. They aren't the same, even if under the hood they both use stack unwinding.
- vacuity 3y agoNaively, what is the difference between panics and exceptions? Is it the philosophy on when/how to use them?
- IshKebab 3y agoYes, and also exceptions can have arbitrary value associated with them. You aren't going to get far using panics as a general error handling mechanism because there's only one type of panic.