
ADDED: * envs.GetEnvErr(), envs.GetEnvErrNoBlank(), envs.EnvErrNoVal This allows error-returned env vars for nonexistent/empty values.
21 lines
1.2 KiB
Go
21 lines
1.2 KiB
Go
package envs
|
|
|
|
type (
|
|
/*
|
|
EnvErrNoVal is an error containing the variable that does not exist
|
|
(and information surrounding the errored state).
|
|
*/
|
|
EnvErrNoVal struct {
|
|
// VarName is the variable name/key name originally specified in the function call.
|
|
VarName string `json:"var" toml:"VariableName" yaml:"Variable Name/Key" xml:"key,attr"`
|
|
// WasFound is only used for GetEnvErrNoBlank(). It is true if the variable was found/populated.
|
|
WasFound bool `json:"found" toml:"Found" yaml:"Found" xml:"found,attr"`
|
|
// WasRequiredNonEmpty indicates that this error was returned in a context where a variable was required to be non-empty (e.g. via GetEnvErrNoBlank()) but was empty.
|
|
WasRequiredNonEmpty bool `json:"reqd_non_empty" toml:"RequiredNonEmpty" yaml:"Required Non-Empty" xml:"reqNonEmpty,attr"`
|
|
// IgnoreWhitespace is true if the value was found but its evaluation was done against a whitestripped version.
|
|
IgnoreWhitespace bool `json:"ignore_ws" toml:"IgnoreWhitespace" yaml:"Ignore Whitespace" xml:"ignoreWhitespace,attr"`
|
|
// WasWhitespace is true if the value was whitespace-only.
|
|
WasWhitespace bool `json:"was_ws" toml:"WasWhitespace" yaml:"Was Whitespace Only" xml:"wasWhitespace,attr"`
|
|
}
|
|
)
|