Minor code maintenance for ModelStore (#492)
This commit is contained in:
parent
97113aa80b
commit
133314ebaa
@ -70,7 +70,7 @@ func tagsForModelWithID(
|
||||
tags map[string]string,
|
||||
) (map[string]string, error) {
|
||||
if !s.Valid() {
|
||||
return nil, errors.New("unrecognized model schema")
|
||||
return nil, errors.WithStack(errUnrecognizedSchema)
|
||||
}
|
||||
|
||||
if len(id) == 0 {
|
||||
@ -182,7 +182,7 @@ func (ms *ModelStore) GetIDsForType(
|
||||
tags map[string]string,
|
||||
) ([]*model.BaseModel, error) {
|
||||
if !s.Valid() {
|
||||
return nil, errors.New("unrecognized model schema")
|
||||
return nil, errors.WithStack(errUnrecognizedSchema)
|
||||
}
|
||||
|
||||
if _, ok := tags[stableIDKey]; ok {
|
||||
@ -222,7 +222,7 @@ func (ms *ModelStore) getModelStoreID(
|
||||
id model.StableID,
|
||||
) (manifest.ID, error) {
|
||||
if !s.Valid() {
|
||||
return "", errors.New("unrecognized model schema")
|
||||
return "", errors.WithStack(errUnrecognizedSchema)
|
||||
}
|
||||
|
||||
if len(id) == 0 {
|
||||
|
||||
@ -144,8 +144,7 @@ func (suite *ModelStoreIntegrationSuite) TestBadModelTypeErrors() {
|
||||
require.NoError(t, suite.m.Put(suite.ctx, model.BackupOpSchema, foo))
|
||||
|
||||
_, err := suite.m.GetIDsForType(suite.ctx, model.UnknownSchema, nil)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "schema")
|
||||
assert.ErrorIs(t, err, errUnrecognizedSchema)
|
||||
}
|
||||
|
||||
func (suite *ModelStoreIntegrationSuite) TestBadTypeErrors() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user