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

That's not what I meant.

Code that handles an error looks like this:

    if err! = nil {
        if fileErr,ok := err.(MissingFileError); ok {
           createFile(fileErr.FileName())
        } else {
            return fmt.Errorf(...)
        } 
    }
While code that does NOT handle an error looks like this:

    if err!=nil {
        return fmt.Errorf(...)
    }


And the former is less than 1% of the cases I’ve seen from experience. Somehow people have fooled themselves into believing that the language forcing humans to be manual exception bubblers somehow means they have “handled” the error.




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

Search: