Fix Err fallout for graph/mongo iterator

This commit is contained in:
Andrew Dunham 2015-04-14 19:11:39 -07:00
parent 5efd90a651
commit bd2b2b73cf

View file

@ -39,6 +39,7 @@ type Iterator struct {
constraint bson.M constraint bson.M
collection string collection string
result graph.Value result graph.Value
err error
} }
func NewIterator(qs *QuadStore, collection string, d quad.Direction, val graph.Value) *Iterator { func NewIterator(qs *QuadStore, collection string, d quad.Direction, val graph.Value) *Iterator {
@ -137,6 +138,7 @@ func (it *Iterator) Next() bool {
if !found { if !found {
err := it.iter.Err() err := it.iter.Err()
if err != nil { if err != nil {
it.err = err
glog.Errorln("Error Nexting Iterator: ", err) glog.Errorln("Error Nexting Iterator: ", err)
} }
return false return false
@ -148,6 +150,10 @@ func (it *Iterator) Next() bool {
return true return true
} }
func (it *Iterator) Err() error {
return it.err
}
func (it *Iterator) ResultTree() *graph.ResultTree { func (it *Iterator) ResultTree() *graph.ResultTree {
return graph.NewResultTree(it.Result()) return graph.NewResultTree(it.Result())
} }