diff --git a/pkg/convert/parser.go b/pkg/convert/parser.go index 6b797c01d7..80737f4c8d 100644 --- a/pkg/convert/parser.go +++ b/pkg/convert/parser.go @@ -13,7 +13,10 @@ import ( // format is a Serialized trie (see transporttrie.Serialize implementation) func ParseTrie(r io.Reader, cb func(name []byte, val int)) error { - t, _ := transporttrie.Deserialize(r) + t, err := transporttrie.Deserialize(r) + if err != nil { + return err + } t.Iterate(func(name []byte, val uint64) { cb(name, int(val)) }) diff --git a/pkg/server/ingest.go b/pkg/server/ingest.go index c268cbe881..2e4005b26e 100644 --- a/pkg/server/ingest.go +++ b/pkg/server/ingest.go @@ -28,9 +28,11 @@ type ingestParams struct { func wrapConvertFunction(convertFunc func(r io.Reader, cb func(name []byte, val int)) error) func(io.Reader) (*tree.Tree, error) { return func(r io.Reader) (*tree.Tree, error) { t := tree.New() - convertFunc(r, func(k []byte, v int) { + if err := convertFunc(r, func(k []byte, v int) { t.Insert(k, uint64(v)) - }) + }); err != nil { + return nil, err + } return t, nil }