Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
estebank
3 months ago
|
parent
|
context
|
favorite
| on:
Matt Godbolt sold me on Rust by showing me C++
For things like this I find that ? still works well enough, but I tend to write code like
match x(y) { Ok(None) => "not found".into(), Ok(Some(x)) => x, Err(e) => handle_error(e), }
Because of pattern matching, I often also have one arm for specific errors to handle them specifically in the same way as the ok branches above.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: