summaryrefslogtreecommitdiff
path: root/parsefuncs.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--parsefuncs.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/parsefuncs.go b/parsefuncs.go
index 0263a5a..793e732 100644
--- a/parsefuncs.go
+++ b/parsefuncs.go
@@ -11,9 +11,14 @@ import (
"strings"
)
+var (
+ // ErrRequired provides a canonical "you must set this flag" error message.
+ ErrRequired = errors.New("must not be empty")
+)
+
func RequiredString(raw string) (interface{}, error) {
if raw == "" {
- return nil, errors.New("must not be empty")
+ return nil, ErrRequired
}
return raw, nil
}