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:
parent
41e4029b0d
commit
046e96cfec
1 changed files with 5 additions and 2 deletions
|
|
@ -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".
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue