Skip to content

Commit

Permalink
chore: add error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thisislawatts committed Sep 3, 2024
1 parent 5832841 commit 1463615
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cliv2/pkg/basic_workflows/globalresources.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ func GetGlobalCertAuthority(config configuration.Configuration, debugLogger *zer
} else if _, existsError := os.Stat(caSingleton.CertFile); errors.Is(existsError, fs.ErrNotExist) { // certificate file does not exist
if len(caSingleton.CertPem) > 0 && len(caSingleton.CertFile) > 0 { // try to re-create file
debugLogger.Printf("Restoring temporary certificate file: %s", caSingleton.CertFile)
utils.WriteToFile(caSingleton.CertFile, caSingleton.CertPem)
err := utils.WriteToFile(caSingleton, caSingleton.CertPem)
if err != nil {
debugLogger.Printf("Failed to write cert to file: %s", caSingleton.CertFile)
return proxy.CaData{}, err
}
} else { // fail for this unexpected case
return proxy.CaData{}, fmt.Errorf("used Certificate Authority is not existing anymore!")
}
Expand Down

0 comments on commit 1463615

Please sign in to comment.