Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10)

Issue 6549056: state: getter methods return NotFoundError

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by niemeyer
Modified:
11 years, 7 months ago
Reviewers:
dave, mp+125917, TheMue
Visibility:
Public.

Description

state: getter methods return NotFoundError Due to the in-progress lifecycle changes, client code must be able to distinguish not found errors. https://code.launchpad.net/~niemeyer/juju-core/resource-not-found/+merge/125917 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : state: getter methods return NotFoundError #

Total comments: 8

Patch Set 3 : state: getter methods return NotFoundError #

Unified diffs Side-by-side diffs Delta from patch set Stats (+96 lines, -48 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/juju/deploy_test.go View 1 chunk +2 lines, -2 lines 0 comments Download
M cmd/juju/expose_test.go View 1 chunk +1 line, -1 line 0 comments Download
M cmd/juju/unexpose_test.go View 1 chunk +1 line, -1 line 0 comments Download
M state/assign_test.go View 2 chunks +2 lines, -2 lines 0 comments Download
M state/charm_test.go View 2 chunks +4 lines, -4 lines 0 comments Download
M state/confignode.go View 1 chunk +0 lines, -9 lines 0 comments Download
M state/machine.go View 1 chunk +1 line, -2 lines 0 comments Download
M state/machine_test.go View 3 chunks +5 lines, -4 lines 0 comments Download
M state/relation_test.go View 2 chunks +9 lines, -4 lines 0 comments Download
M state/service_test.go View 2 chunks +2 lines, -2 lines 0 comments Download
M state/state.go View 1 2 6 chunks +37 lines, -6 lines 0 comments Download
M state/state_test.go View 4 chunks +20 lines, -7 lines 0 comments Download
M state/unit.go View 4 chunks +4 lines, -4 lines 0 comments Download
M state/unit_test.go View 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 6
niemeyer
Please take a look.
11 years, 7 months ago (2012-09-24 03:50:54 UTC) #1
niemeyer
Please take a look.
11 years, 7 months ago (2012-09-24 04:08:27 UTC) #2
dave_cheney.net
LGTM. Thank you, this is a significant improvement. https://codereview.appspot.com/6549056/diff/2002/state/state.go File state/state.go (right): https://codereview.appspot.com/6549056/diff/2002/state/state.go#newcode53 state/state.go:53: comment ...
11 years, 7 months ago (2012-09-24 05:20:35 UTC) #3
TheMue
LGTM, only a small comment. https://codereview.appspot.com/6549056/diff/2002/state/state.go File state/state.go (right): https://codereview.appspot.com/6549056/diff/2002/state/state.go#newcode55 state/state.go:55: return &NotFoundError{format, args} If ...
11 years, 7 months ago (2012-09-24 09:37:11 UTC) #4
rog
looks reasonable, but one thought below. https://codereview.appspot.com/6549056/diff/2002/state/state.go File state/state.go (right): https://codereview.appspot.com/6549056/diff/2002/state/state.go#newcode46 state/state.go:46: format string i'm ...
11 years, 7 months ago (2012-09-24 14:12:03 UTC) #5
niemeyer
11 years, 7 months ago (2012-09-24 14:38:25 UTC) #6
*** Submitted:

state: getter methods return NotFoundError

Due to the in-progress lifecycle changes, client code
must be able to distinguish not found errors.

R=dfc, TheMue, rog
CC=
https://codereview.appspot.com/6549056

https://codereview.appspot.com/6549056/diff/2002/state/state.go
File state/state.go (right):

https://codereview.appspot.com/6549056/diff/2002/state/state.go#newcode46
state/state.go:46: format string
On 2012/09/24 14:12:04, rog wrote:
> i'm not sure that i see the benefit in storing the format and args here. are
we
> really concerned that the work involved in formatting the error message is
going
> to slow us down?

I certainly don't care enough to argue. I'll change it.

https://codereview.appspot.com/6549056/diff/2002/state/state.go#newcode53
state/state.go:53: 
On 2012/09/24 05:20:35, dfc wrote:
> comment please.

I honestly think it's not worth it in this case. Reading the body of the
function is more clear and takes less time than reading any comments we add
here, and since it's a private function it won't show up in the docs.

https://codereview.appspot.com/6549056/diff/2002/state/state.go#newcode55
state/state.go:55: return &NotFoundError{format, args}
On 2012/09/24 09:37:11, TheMue wrote:
> If no later access to the args is planned the error message could already be

Changed so NotFoundError has a dumb msg argument.

https://codereview.appspot.com/6549056/diff/2002/state/state.go#newcode384
state/state.go:384: func (s *State) Relation(endpoints ...RelationEndpoint) (r
*Relation, err error) {
On 2012/09/24 05:20:35, dfc wrote:
> suggestion: drop the named return values as we're not using defer
ErrorContextf
> anymore in this method.

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b