Better parsing error for scope and template
continuous-integration/woodpecker the build was successful Details

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2021-11-23 22:20:41 -06:00
parent 2514b79913
commit f27be2ffff
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
package spectre package spectre
import ( import (
"errors" "fmt"
"strings" "strings"
) )
@ -41,7 +41,7 @@ func ParseScope(s string) (Scope, error) {
case "recovery", "r": case "recovery", "r":
return Recovery, nil return Recovery, nil
default: default:
return "", errors.New("unknown Scope") return "", fmt.Errorf("unknown Scope %q; available [authentication, identification, recovery]", s)
} }
} }

View File

@ -1,7 +1,7 @@
package spectre package spectre
import ( import (
"errors" "fmt"
"strings" "strings"
) )
@ -39,7 +39,7 @@ func ParseTemplate(s string) (Template, error) {
case "basic": case "basic":
return Basic, nil return Basic, nil
default: default:
return "", errors.New("unknown Template") return "", fmt.Errorf("unknown Template %q; available [maximum, long, medium, short, pin, name, phrase, basic]", s)
} }
} }