Skip to content

Commit e1faee7

Browse files
authored
feat: unknown primitive error message
error message for unknown primitive type
2 parents e8abe87 + 3b491b3 commit e1faee7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,15 @@ func GetModel(conf ModelReaderConf, desiredSize MeshTypes.Vector) (*MeshTypes.Me
4848
default:
4949
return nil, fmt.Errorf("unknown model type %s", filetype)
5050
}
51-
} else if conf.PrimitiveType != "Undefined" && Primitives.Primitives[conf.PrimitiveType] != nil {
51+
} else if conf.PrimitiveType != "Undefined" {
52+
if Primitives.Primitives[conf.PrimitiveType] == nil {
53+
return nil, fmt.Errorf("unknown primitive type %s", conf.PrimitiveType)
54+
}
5255
tempMesh := Primitives.Primitives[conf.PrimitiveType].Copy()
5356
mesh = &tempMesh
5457
mesh.ScaleToDimensions(&desiredSize)
58+
} else {
59+
return nil, fmt.Errorf("invalid ModelReader config")
5560
}
5661

5762
return mesh, nil

0 commit comments

Comments
 (0)