Skip to content

Commit

Permalink
misc: improve styling of errs
Browse files Browse the repository at this point in the history
Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Oct 11, 2023
1 parent 1e4b1a0 commit 6a98d99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/secret/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func parseAuthMap(config dockerConfig) (map[string]authn.AuthConfig, error) {

func getURLHost(urlStr string) (string, error) {
if urlStr == "http://" || urlStr == "https://" {
return "", errors.New("Empty url")
return "", errors.New("empty url")
}

// ensure url has https:// or http:// prefix
Expand All @@ -220,9 +220,9 @@ func getURLHost(urlStr string) (string, error) {
}

if u.Host == "" {
return "", errors.New(fmt.Sprintf(
"Invalid registry auth key: %s. Expected an HTTPS URL (e.g. 'https://index.docker.io/v2/' or 'https://index.docker.io'), or the same without the 'https://' (e.g., 'index.docker.io/v2/' or 'index.docker.io')",
urlStr))
return "", fmt.Errorf(
"expected an HTTPS URL instead of '%s' (e.g. 'https://index.docker.io/v2/' or 'https://index.docker.io'), or the same without 'https://' (e.g., 'index.docker.io/v2/' or 'index.docker.io')",
urlStr)
}

return u.Host, nil
Expand Down

0 comments on commit 6a98d99

Please sign in to comment.