-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
33 lines (25 loc) · 990 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package envcnf
import (
"errors"
"fmt"
)
// ErrNeedPointerValue is returned by NewParser or NewParserWithName if it is
// called with a plain value instead of a pointer.
var ErrNeedPointerValue = errors.New("envcnf: val needs to be a pointer")
// MissingEnvVar is returned when no env var with a name fitting the scheme
// for given field can be found.
type MissingEnvVar string
func (e MissingEnvVar) Error() string {
return fmt.Sprintf("envcnf: missing env var %q", string(e))
}
// FieldNotAddressable is returned when a structfield is not addressable.
// See reflect.Addr and reflect.CanAddr if you don't know what this means.
type FieldNotAddressable string
func (e FieldNotAddressable) Error() string {
return fmt.Sprintf("envcnf: struct field %q not addressable", string(e))
}
// UnsupportedType is returned when a type is not supported.
type UnsupportedType string
func (e UnsupportedType) Error() string {
return fmt.Sprintf("envcnf: unsupported type %q", string(e))
}