diff options
author | Ethel Morgan <eth@ethulhu.co.uk> | 2020-07-07 15:35:24 +0100 |
---|---|---|
committer | Ethel Morgan <eth@ethulhu.co.uk> | 2020-07-07 15:35:24 +0100 |
commit | e871aa3046a981eccf9b2a042b7d2ced9f109355 (patch) | |
tree | 0edcf2d5ad417f20c26a4462b05f59c6d6cf16e6 | |
parent | aa380da6a61f9b29ee263d95d17a2953a0528b28 (diff) |
Diffstat (limited to '')
-rw-r--r-- | parsefuncs.go | 7 |
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 } |