Skip to content

Commit

Permalink
Fix case of template download failure message (#1726)
Browse files Browse the repository at this point in the history
* Fix case of template download failure message

Make the case consistent with other error messages

Signed-off-by: Zabil Cheriya Maliackal <zabilcm@gmail.com>

* Fix error message

Signed-off-by: Zabil Cheriya Maliackal <zabilcm@gmail.com>

Co-authored-by: Vinay Shankar Shukla <vinaysh@thoughtworks.com>
  • Loading branch information
zabil and Vinay Shankar Shukla committed Aug 28, 2020
1 parent 864c4e4 commit 6aec680
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions projectInit/init.go
Expand Up @@ -146,11 +146,11 @@ func Template(name string, silent bool) {
func fromTemplateName(templateName string, silent bool) {
templateURL, err := template.Get(templateName)
if err != nil {
logger.Fatalf(true, fmt.Errorf("failed to initialize project. %w", err).Error())
logger.Fatalf(true, fmt.Errorf("Failed to initialize project. %w", err).Error())
}
checkURL(templateURL)
if err := initializeTemplate(templateURL); err != nil {
logger.Fatalf(true, fmt.Errorf("failed to initialize project. %w", err).Error())
logger.Fatalf(true, fmt.Errorf("Failed to initialize project. %w", err).Error())
}
installRunner(silent)
}
Expand Down
4 changes: 2 additions & 2 deletions template/template.go
Expand Up @@ -60,9 +60,9 @@ func (t *templates) get(k string) (string, error) {
}
matches := t.closestMatch(k)
if len(matches) > 0 {
return "", fmt.Errorf("cannot find a Gauge template '%s'.\nThe most similar template names are\n\n\t%s", k, strings.Join(matches, "\n\t"))
return "", fmt.Errorf("Cannot find Gauge template '%s'.\nThe most similar template names are\n\n\t%s", k, strings.Join(matches, "\n\t"))
}
return "", fmt.Errorf("cannot find a Gauge template '%s'", k)
return "", fmt.Errorf("Cannot find Gauge template '%s'", k)
}

func (t *templates) closestMatch(k string) []string {
Expand Down
4 changes: 2 additions & 2 deletions template/template_test.go
Expand Up @@ -106,7 +106,7 @@ func TestGetShouldGetTemplateIfDoesNotExists(t *testing.T) {
if e == nil {
t.Errorf("expected error. got nil")
}
expected := "cannot find a Gauge template 'hello'"
expected := "Cannot find Gauge template 'hello'"
if e.Error() != expected {
t.Errorf("expected error to be \n'%s'\nGot:\n'%s'", expected, e.Error())
}
Expand All @@ -118,7 +118,7 @@ func TestGetShouldGetSimilarTemplatesIfDoesNotExists(t *testing.T) {
if e == nil {
t.Errorf("expected error. got nil")
}
expected := `cannot find a Gauge template 'jaba'.
expected := `Cannot find Gauge template 'jaba'.
The most similar template names are
java
Expand Down

0 comments on commit 6aec680

Please sign in to comment.