mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-10-22 11:08:20 +00:00
Add error handling for ForEach's.
This commit is contained in:
1 parent
be7a1762ac
commit
218057ea48
9 files changed
+151
-40
No files matched your search
Vendored
+13
-1
@@ -1,6 +1,7 @@
|
||||
package debian
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/smira/aptly/database"
|
||||
"github.com/smira/aptly/utils"
|
||||
. "launchpad.net/gocheck"
|
||||
@@ -187,8 +188,19 @@ func (s *RemoteRepoCollectionSuite) TestForEach(c *C) {
|
||||
s.collection.Add(repo)
|
||||
|
||||
count := 0
|
||||
s.collection.ForEach(func(*RemoteRepo) { count++ })
|
||||
err := s.collection.ForEach(func(*RemoteRepo) error {
|
||||
count++
|
||||
return nil
|
||||
})
|
||||
c.Assert(count, Equals, 1)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
e := errors.New("c")
|
||||
|
||||
err = s.collection.ForEach(func(*RemoteRepo) error {
|
||||
return e
|
||||
})
|
||||
c.Assert(err, Equals, e)
|
||||
}
|
||||
|
||||
const exampleReleaseFile = `Origin: LP-PPA-agenda-developers-daily
|
||||
|
||||
Reference in new issue
Block a user