From accbc6007e6f86a497aef48186261bf08b9922e5 Mon Sep 17 00:00:00 2001 From: Andrew Dunham Date: Wed, 15 Apr 2015 10:51:22 -0700 Subject: [PATCH] Move Err() method to Iterator interface, fix fallout --- graph/iterator.go | 6 +++--- graph/iterator/optional_iterator.go | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/graph/iterator.go b/graph/iterator.go index 63ccade..46cc9f9 100644 --- a/graph/iterator.go +++ b/graph/iterator.go @@ -100,6 +100,9 @@ type Iterator interface { // Contains returns whether the value is within the set held by the iterator. Contains(Value) bool + // Err returns the error (if any) encountered during iteration. + Err() error + // Start iteration from the beginning Reset() @@ -160,9 +163,6 @@ type Nexter interface { // between the two cases. Next() bool - // Err returns the error (if any) encountered during iteration. - Err() error - Iterator } diff --git a/graph/iterator/optional_iterator.go b/graph/iterator/optional_iterator.go index f39f57d..c8c7fec 100644 --- a/graph/iterator/optional_iterator.go +++ b/graph/iterator/optional_iterator.go @@ -76,6 +76,10 @@ func (it *Optional) ResultTree() *graph.ResultTree { return graph.NewResultTree(it.Result()) } +func (it *Optional) Err() error { + return it.subIt.Err() +} + func (it *Optional) Result() graph.Value { return it.result }