Fix Err fallout for graph/iterator.Or iterator

This commit is contained in:
Andrew Dunham 2015-04-14 18:49:02 -07:00
parent 40cbbfcc1b
commit aaa3f27754
2 changed files with 54 additions and 0 deletions

View file

@ -33,6 +33,7 @@ type Or struct {
itCount int
currentIterator int
result graph.Value
err error
}
func NewOr() *Or {
@ -147,6 +148,11 @@ func (it *Or) Next() bool {
return graph.NextLogOut(it, it.result, true)
}
if err := graph.Err(curIt); err != nil {
it.err = err
return graph.NextLogOut(it, nil, false)
}
if it.isShortCircuiting && !first {
break
}
@ -159,6 +165,10 @@ func (it *Or) Next() bool {
return graph.NextLogOut(it, nil, false)
}
func (it *Or) Err() error {
return it.err
}
func (it *Or) Result() graph.Value {
return it.result
}