3 ms·
> Java with checked vs unchecked exceptions Java doesn't make it nice to deal with exceptions though. Converting a checked exception into an unchecked exceptio
by rovolo 3y ago
> Java with checked vs unchecked exceptions
Java doesn't make it nice to deal with exceptions though. Converting a checked exception into an unchecked exception is incredibly wordy:
int output;
try {
output = doSomething();
} catch (IOException io) {
throw new RuntimeException(io);
}
vs Rust's method of defaulting an error result to a panic:
let output = doSomething().unwrap()
https://doc.rust-lang.org/std/result/ https://doc.rust-lang.org/std/result/