Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit e5966cb

Browse files
William Douglasbryteise
authored andcommitted
Identify manifest in logging
Improve the usability of log messages by indicating which manifest is invalid when printing errors. Signed-off-by: William Douglas <william.douglas@intel.com>
1 parent 4d475a2 commit e5966cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

swupd/manifest.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,18 @@ func readManifestFileEntry(fields []string, m *Manifest) error {
187187
// CheckHeaderIsValid verifies that all header fields in the manifest are valid.
188188
func (m *Manifest) CheckHeaderIsValid() error {
189189
if m.Header.Format == 0 {
190-
return errors.New("manifest format not set")
190+
return errors.Errorf("manifest format not set (%s)", m.Name)
191191
}
192192

193193
if m.Header.Version == 0 {
194-
return errors.New("manifest has version zero, version must be positive")
194+
return errors.Errorf("manifest has version zero, version must be positive (%s)", m.Name)
195195
}
196196
if m.Header.FileCount == 0 {
197-
return errors.New("manifest has a zero file count")
197+
return fmt.Errorf("manifest has a zero file count (%s)", m.Name)
198198
}
199199

200200
if m.Header.TimeStamp.IsZero() {
201-
return errors.New("manifest timestamp not set")
201+
return errors.Errorf("manifest timestamp not set (%s)", m.Name)
202202
}
203203

204204
// Includes are not required.

0 commit comments

Comments
 (0)