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 {
177
177
Dynamic []string `json:"dynamic"`
178
178
}
179
179
180
- func (bd * BaseDistribution ) GetHeaderAttrs () []HeaderAttr {
180
+ func (bd * BaseDistribution ) GetHeaderAttrs () ( []HeaderAttr , error ) {
181
181
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 )
184
184
}
185
- return []HeaderAttr {}
185
+
186
+ return ha , nil
186
187
}
187
188
188
189
func (bd * BaseDistribution ) Parse (data []byte ) error {
@@ -200,7 +201,12 @@ func (bd *BaseDistribution) Parse(data []byte) error {
200
201
bd .MetadataVersion = headerValue
201
202
}
202
203
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 {
204
210
if headerAttr .AttrName == "metadata_version" {
205
211
continue
206
212
}
You can’t perform that action at this time.
0 commit comments