Skip to content

Commit aee8b2e

Browse files
Improved unmarshal error message (#227)
1 parent 8667d7e commit aee8b2e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

internal/upload/batch.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func (uploadBatch *uploadBatch) initAnalysis() error {
195195
}
196196
defer response.Body.Close()
197197
if response.StatusCode != http.StatusNoContent {
198-
return fmt.Errorf("Failed to initialize scan due to status code %d", response.StatusCode)
198+
return fmt.Errorf("failed to initialize scan due to status code %d", response.StatusCode)
199199
} else {
200200
fmt.Println("Successfully initialized scan")
201201
}
@@ -347,13 +347,20 @@ func GetDebrickedConfig(path string) *DebrickedConfig {
347347
var yamlConfig DebrickedConfigYAML
348348
yamlFile, err := os.ReadFile(path)
349349
if err != nil {
350-
fmt.Printf("Failed to read debricked config file on path \"%s\"", path)
350+
fmt.Printf(
351+
"%s Failed to read debricked config file on path \"%s\"",
352+
color.YellowString("⚠️"),
353+
path,
354+
)
351355

352356
return nil
353357
}
354358
err = yaml.Unmarshal(yamlFile, &yamlConfig)
355359
if err != nil {
356-
fmt.Printf("Failed to unmarshal debricked config, is the format correct? \"%s\"", yamlFile)
360+
fmt.Printf("%s Failed to unmarshal debricked config: \"%s\"\n",
361+
color.YellowString("⚠️"),
362+
color.RedString(err.Error()),
363+
)
357364

358365
return nil
359366
}

0 commit comments

Comments
 (0)