File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -177,12 +177,13 @@ type BaseDistribution struct {
177177 Dynamic []string `json:"dynamic"`
178178}
179179
180- func (bd * BaseDistribution ) GetHeaderAttrs () []HeaderAttr {
180+ func (bd * BaseDistribution ) GetHeaderAttrs () ( []HeaderAttr , error ) {
181181 ha , exists := HeaderAttrs [bd .MetadataVersion ]
182- if exists {
183- return ha
182+ if ! exists {
183+ return [] HeaderAttr {}, fmt . Errorf ( "header attributes for metadata version %s not found" , bd . MetadataVersion )
184184 }
185- return []HeaderAttr {}
185+
186+ return ha , nil
186187}
187188
188189func (bd * BaseDistribution ) Parse (data []byte ) error {
@@ -200,7 +201,12 @@ func (bd *BaseDistribution) Parse(data []byte) error {
200201 bd .MetadataVersion = headerValue
201202 }
202203
203- for _ , headerAttr := range bd .GetHeaderAttrs () {
204+ headerAttrs , err := bd .GetHeaderAttrs ()
205+ if err != nil {
206+ return err
207+ }
208+
209+ for _ , headerAttr := range headerAttrs {
204210 if headerAttr .AttrName == "metadata_version" {
205211 continue
206212 }
You can’t perform that action at this time.
0 commit comments