1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Improve exit code for failed upload

* Add an exit code if an upload failed, but also print all the messages
   as before.
This commit is contained in:
Bernhard Reiter 2022-05-10 16:46:32 +02:00
parent 41e4029b0d
commit 046e96cfec
No known key found for this signature in database
GPG key ID: 2B7BA3BF9BC3A554

View file

@ -288,8 +288,11 @@ func (p *processor) process(filename string) error {
}
defer resp.Body.Close()
var uploadErr error
if resp.StatusCode != http.StatusOK {
log.Printf("Upload failed: %s\n", resp.Status)
s := fmt.Sprintf("upload failed: %s", resp.Status)
fmt.Printf("HTTPS %s\n", s)
uploadErr = errors.New(s)
}
var result struct {
@ -313,7 +316,7 @@ func (p *processor) process(filename string) error {
writeStrings("Warnings:", result.Warnings)
writeStrings("Errors:", result.Errors)
return nil
return uploadErr
}
// findIniFile looks for a file in the pre-defined paths in "iniPaths".