Code review comment for lp:~themue/pyjuju/go-state-topology-relation-endpoints

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

https://codereview.appspot.com/6198055/diff/5001/state/topology.go
File state/topology.go (right):

https://codereview.appspot.com/6198055/diff/5001/state/topology.go#newcode545
state/topology.go:545: return "", nil
If the developer asks for a RelationKey, and it doesn't exist, an error
should be returned. Silently returning nothing and hoping that the
developer remembers to check for the case where it doesn't exist every
time is extremely error prone.

Imagine if you had to do this:

     f, err := os.Open(filename)
     if err != nil {
          ...
     }
     if f != nil {
          ...
     }
     ...

Every time!

The documentation should reflect the change too.

https://codereview.appspot.com/6198055/diff/5001/state/topology.go#newcode571
state/topology.go:571: return "", nil
Ditto.

https://codereview.appspot.com/6198055/

« Back to merge proposal