forked from reddit/baseplate.go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
39 lines (32 loc) · 1.07 KB
/
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
34
35
36
37
38
39
package secrets
import (
"errors"
"fmt"
)
// ErrInvalidEncoding is the error returned by the parser when we got an invalid
// encoding in the secrets.json file.
var ErrInvalidEncoding = errors.New("secrets: invalid encoding, expected identity, base64 or empty")
// ErrEmptySecretKey is returned when the path for a secret is empty.
var ErrEmptySecretKey = errors.New("secrets: secret path cannot be empty")
// TooManyFieldsError is a type of errors could be returned by
// Document.Validate.
//
// Note that Document.Validate could also return a BatchError containing
// multiple TooManyFieldsError.
type TooManyFieldsError struct {
Key string
SecretType string
}
func (e TooManyFieldsError) Error() string {
return fmt.Sprintf(
"secrets: expected %q secret but other fields were present for %q",
e.SecretType,
e.Key,
)
}
// SecretNotFoundError is returned when the key for a secret is not present in
// the secret store.
type SecretNotFoundError string
func (path SecretNotFoundError) Error() string {
return "secrets: no secret has been found for " + string(path)
}