1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-07 13:31:37 +02:00

fix: improve error message

refs #4160
This commit is contained in:
Carlos Alexandro Becker 2023-07-03 19:01:11 +00:00
parent c57cdab0c6
commit 86beb584bf
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 12 additions and 1 deletions

View File

@ -36,7 +36,7 @@ func getInstanceURL(ctx *context.Context) (string, error) {
u.Path = ""
rawurl := u.String()
if rawurl == "" {
return "", fmt.Errorf("invalid URL: %v", apiURL)
return "", fmt.Errorf("invalid URL: %q", ctx.Config.GiteaURLs.API)
}
return rawurl, nil
}

View File

@ -625,3 +625,14 @@ func TestGiteaChangelog(t *testing.T) {
_, err = client.Changelog(ctx, repo, "v1.0.0", "v1.1.0")
require.EqualError(t, err, ErrNotImplemented.Error())
}
func TestGetInstanceURL(t *testing.T) {
ctx := testctx.NewWithCfg(config.Project{
GiteaURLs: config.GiteaURLs{
API: "http://our.internal.gitea.media/api/v1",
},
})
url, err := getInstanceURL(ctx)
require.NoError(t, err)
require.Equal(t, "http://our.internal.gitea.media", url)
}