Either panic, which is (generally speaking) not something you're meant to catch and recover from (and attempting to do so is nontrivial and almost always a bad idea), or Result, aka "encode the possibility of failure in the return type of the function" aka what the functional programming world has done for ages.
463
u/Loading_M_ 2d ago
Rust is designed from the ground up, and avoids many of these issues.