Skip to content

Commit

Permalink
Add a comment clarifying sequence<0 argument. Fix error message (thanks
Browse files Browse the repository at this point in the history
pedronis).
  • Loading branch information
stolowski committed Jan 27, 2021
1 parent e2eed5f commit 840583c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions store/store_asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ func (s *Store) Assertion(assertType *asserts.AssertionType, primaryKey []string
}

// SeqFormingAssertion retrieves the sequence-forming assertion for the given
// type (currently validation-set only).
// type (currently validation-set only). For sequence <= 0 we query for the
// latest sequence, otherwise the latest revision of the given sequence is
// requested.
func (s *Store) SeqFormingAssertion(assertType *asserts.AssertionType, sequenceKey []string, sequence int, user *auth.UserState) (asserts.Assertion, error) {
if !assertType.SequenceForming() {
return nil, fmt.Errorf("internal error: requested non sequence-forming assertion type %q", assertType.Name)
Expand Down Expand Up @@ -140,7 +142,7 @@ func (s *Store) SeqFormingAssertion(assertType *asserts.AssertionType, sequenceK
for i, keyVal := range sequenceKey {
name := assertType.PrimaryKey[i]
if keyVal == "" {
return fmt.Errorf("primary key %q header cannot be empty", name)
return fmt.Errorf("sequence key %q header cannot be empty", name)
}
headers[name] = keyVal
}
Expand Down

0 comments on commit 840583c

Please sign in to comment.