Hacker News new | past | comments | ask | show | jobs | submit login

The GP said

> Users would rather see an error saying “whoopsie, maybe try that again later” than for the program to exit

To achieve this, you need to catch panics. Rust does not use Result for things the OP is talking about like asserts.




If you want to handle the assert cases, you should not use the asserts in the first place.


That isn't possible. The assert may not even be produced in code you control.

The reason panics/exceptions exist is it is too onerous to handle every possible error condition at all callsites (allocation failure and broken pipes are the famous examples), and it is not possible to enumerate all possible error conditions (unintentional programmer errors for example).

People have religious ideas about handling panics for some reason.


Panics shouldn't exist in modern Rust (if there is such a thing) at all.


I take it you mean panics should always abort?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: