close file in error handling branch
Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
parent
79fa437969
commit
ead84a2acc
1 changed files with 3 additions and 0 deletions
|
|
@ -39,6 +39,9 @@ func (s *LiveStore) createMetadataFile(artifactDigest string, attestationsResp [
|
|||
bundle := resp.Bundle
|
||||
attBytes, err := json.Marshal(bundle)
|
||||
if err != nil {
|
||||
if err = f.Close(); err != nil {
|
||||
return "", errors.Join(ErrAttestationFileCreation, fmt.Errorf("failed to close file while marshalling JSON: %w", err))
|
||||
}
|
||||
return "", errors.Join(ErrAttestationFileCreation, fmt.Errorf("failed to marshall attestation to JSON while writing to file: %w", err))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue