-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
32 lines (24 loc) · 849 Bytes
/
errors.go
File metadata and controls
32 lines (24 loc) · 849 Bytes
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
package fig
import "errors"
// Sentinel errors for configuration loading.
var (
// ErrRequired indicates a required field was not set.
ErrRequired = errors.New("fig: required field not set")
// ErrInvalidType indicates a value could not be converted to the target type.
ErrInvalidType = errors.New("fig: invalid type conversion")
// ErrNotStruct indicates Load was called with a non-struct type.
ErrNotStruct = errors.New("fig: type must be a struct")
// ErrSecretNotFound indicates a secret was not found in the provider.
ErrSecretNotFound = errors.New("fig: secret not found")
)
// FieldError wraps an error with field context.
type FieldError struct {
Err error
Field string
}
func (e *FieldError) Error() string {
return "fig: field " + e.Field + ": " + e.Err.Error()
}
func (e *FieldError) Unwrap() error {
return e.Err
}