improve version error formatting

This commit is contained in:
Aneurin Barker Snook
2024-07-11 22:34:57 +01:00
parent e69de8b117
commit 6b77391d28
4 changed files with 44 additions and 14 deletions
+3 -3
View File
@@ -24,7 +24,7 @@ func Parse(str string) (*Version, error) {
v := &Version{Text: string(str)}
if len(str) == 0 {
return nil, ErrInvalidVersion
return nil, invalid(str)
}
section := sectionMajor
@@ -32,13 +32,13 @@ func Parse(str string) (*Version, error) {
commit := func() error {
if len(chars) == 0 {
return ErrInvalidVersion
return invalid(str)
}
if section < sectionExtension {
n, err := strconv.Atoi(string(chars))
if err != nil {
return ErrInvalidVersion
return invalid(str)
}
switch section {