Browse Source

Better parsing error for scope and template

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2 weeks ago
parent
commit
f27be2ffff
Signed by: jolheiser GPG Key ID: B853ADA5DA7BBF7A
  1. 4
      scope.go
  2. 4
      template.go

4
scope.go

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

4
template.go

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

Loading…
Cancel
Save