4 ms·
I don't believe so, no. You can set panics to automatically abort, though. But that's opt-in. The real point is that panics are absolutely unchecked exception
by ragnese 6y ago
I don't believe so, no.
You can set panics to automatically abort, though. But that's opt-in.
The real point is that panics are absolutely unchecked exceptions, but it's really awkward to catch them and the standard library and entire Rust ecosystem has a good, solid, culture around returning Results whenever reasonable.
The problem with Java is that a bunch of people have no idea what they are "supposed" to do with the unhappy path parts of their programs.
- tsimionescu 6y agoWell, as long as the option of disabling panic handling exists, and if it is somewhat widely used in real applications, library writers can't rely on panics as an error-handling mechanism, so generally they have to treat it as if panics can abort the program. I think the problem of deciding what to do on the unhappy path is often very difficult, a lot of the time much harder than the actual happy path. This is true regardless of the error reporting/bubbling mechanism.