Skip to content

Commit e511fd7

Browse files
author
Luca Bianconi
committed
fix: error messages
1 parent 35eec5e commit e511fd7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Diff for: commands/sketch/new.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,13 @@ func validateSketchName(name string) error {
7575
return &arduino.CantCreateSketchError{Cause: errors.New(tr("sketch name cannot be empty"))}
7676
}
7777
if len(name) > sketchNameMaxLength {
78-
return &arduino.CantCreateSketchError{Cause: errors.New(tr("sketch name too long (%d characters). Maximum allowed length is %d",
78+
return &arduino.CantCreateSketchError{Cause: errors.New(tr("sketch name too long (%[1]d characters). Maximum allowed length is %[2]d",
7979
len(name),
8080
sketchNameMaxLength))}
8181
}
8282
if !sketchNameValidationRegex.MatchString(name) {
83-
return &arduino.CantCreateSketchError{Cause: errors.New(tr("invalid sketch name \"%s\". Required pattern %s",
84-
name,
85-
sketchNameValidationRegex.String()))}
83+
return &arduino.CantCreateSketchError{Cause: errors.New(tr(`invalid sketch name \"%[1]s\": the first character must be alphanumeric, the following ones can also contain "_", "-", and ".".`,
84+
name))}
8685
}
8786
return nil
8887
}

0 commit comments

Comments
 (0)