|
|
|
|
|
by geofft
2731 days ago
|
|
It says "(exception: simple error checks for a client API call)" and that seems accurate to me. In particular Go (like C) has no built-in exception "throwing" / unwinding support, so for any function call where you want to pass an error onto the caller, you need to do something like result, err := try_to_get_a_result()
if err != nil {
return nil, err
}
See also https://blog.golang.org/error-handling-and-go . As far as I can tell, all of the if-statements without else-clauses are doing just this.(It would be nice in theory if there were better language support for making this lexically obvious but they're in a language where that's not doable.) |
|