Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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: