Skip to content

Commit b099ca8

Browse files
authored
chore(pipeline): change error message to use var (#2627)
Just a tiny change to use the var introduced in #2523. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 6a758d5 commit b099ca8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

internal/pkg/cli/pipeline_init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func (o *initPipelineOpts) validateURL(url string) error {
218218
// Note: no longer calling `validateDomainName` because if users use git-remote-codecommit
219219
// (the HTTPS (GRC) protocol) to connect to CodeCommit, the url does not have any periods.
220220
if !strings.Contains(url, githubURL) && !strings.Contains(url, ccIdentifier) && !strings.Contains(url, bbURL) {
221-
return errors.New("Copilot currently accepts URLs to only GitHub, CodeCommit, and Bitbucket repository sources")
221+
return fmt.Errorf("must be a URL to a supported provider (%s)", strings.Join(manifest.PipelineProviders, ", "))
222222
}
223223
return nil
224224
}

internal/pkg/cli/pipeline_init_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestInitPipelineOpts_Validate(t *testing.T) {
5353
m.EXPECT().GetApplication("my-app").Return(&config.Application{Name: "my-app"}, nil)
5454
},
5555

56-
expectedError: errors.New("Copilot currently accepts URLs to only GitHub, CodeCommit, and Bitbucket repository sources"),
56+
expectedError: errors.New("must be a URL to a supported provider (GitHub, CodeCommit, Bitbucket)"),
5757
},
5858
"invalid environments": {
5959
inAppName: "my-app",
@@ -323,7 +323,7 @@ func TestInitPipelineOpts_Ask(t *testing.T) {
323323
},
324324
mockSessProvider: func(m *mocks.MocksessionProvider) {},
325325

326-
expectedError: fmt.Errorf("Copilot currently accepts URLs to only GitHub, CodeCommit, and Bitbucket repository sources"),
326+
expectedError: fmt.Errorf("must be a URL to a supported provider (GitHub, CodeCommit, Bitbucket)"),
327327
},
328328
"returns error if fail to parse GitHub URL": {
329329
inEnvironments: []string{},

0 commit comments

Comments
 (0)