better error message

This commit is contained in:
Chris Lu 2020-09-02 17:17:44 -07:00
parent 7c770b727c
commit ecaa30c408

View file

@ -109,6 +109,10 @@ func (store *MongodbStore) InsertEntry(ctx context.Context, entry *filer.Entry)
Meta: meta,
})
if err != nil {
return fmt.Errorf("InsertEntry %st: %v", entry.FullPath, err)
}
return nil
}
@ -124,6 +128,7 @@ func (store *MongodbStore) FindEntry(ctx context.Context, fullpath util.FullPath
var where = bson.M{"directory": dir, "name": name}
err = store.connect.Database(store.database).Collection(store.collectionName).FindOne(ctx, where).Decode(&data)
if err != mongo.ErrNoDocuments && err != nil {
glog.Error("find %s: %v", fullpath, err)
return nil, filer_pb.ErrNotFound
}