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

Merge pull request #671 from gocsaf/fix-create-error-handling

Fix #669
This commit is contained in:
Christoph Klassen 2025-09-01 11:13:56 +02:00 committed by GitHub
commit a2fab16d3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -81,8 +81,9 @@ func (p *processor) create() error {
} }
defer resp.Body.Close() defer resp.Body.Close()
var createError error
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
log.Printf("Create failed: %s\n", resp.Status) createError = fmt.Errorf("create failed: %s", resp.Status)
} }
var result struct { var result struct {
@ -100,7 +101,7 @@ func (p *processor) create() error {
writeStrings("Errors:", result.Errors) writeStrings("Errors:", result.Errors)
return nil return createError
} }
// uploadRequest creates the request for uploading a csaf document by passing the filename. // uploadRequest creates the request for uploading a csaf document by passing the filename.