We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1837a5d commit 1469d8dCopy full SHA for 1469d8d
config/options.go
@@ -43,6 +43,10 @@ func (ll *LogLevel) Level() log.Level {
43
return (log.Level)(*ll)
44
}
45
46
+var (
47
+ // Define a static error
48
+ ErrInvalidDataType = errors.New("invalid data type, expected string")
49
+)
50
func LogLevelDecodeHookFunc() mapstructure.DecodeHookFunc {
51
return func(
52
f reflect.Type,
@@ -59,7 +63,7 @@ func LogLevelDecodeHookFunc() mapstructure.DecodeHookFunc {
59
63
60
64
str, ok := data.(string)
61
65
if !ok {
62
- return InfoLevel, fmt.Errorf("expected string but got %T", data)
66
+ rereturn InfoLevel, fmt.Errorf("%w: got %T", ErrInvalidDataType, data)
67
68
69
level, err := log.ParseLevel(str)
0 commit comments