-
Notifications
You must be signed in to change notification settings - Fork 4
/
errors.go
32 lines (24 loc) · 955 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
package keys
import "fmt"
// ErrGetKeySource represents an error when failing to get the source
type ErrGetKeySource struct {
msg interface{}
}
func (e ErrGetKeySource) Error() string {
return fmt.Sprintf("failed to get the key source: %v", e.msg)
}
// ErrReadResponse represents an error when failing to read the source data
type ErrReadResponse struct {
msg interface{}
}
func (e ErrReadResponse) Error() string {
return fmt.Sprintf("failed to read the key response: %v", e.msg)
}
var (
// ErrNoSourcesResolved represents an error for when no sources could be resolved at all
ErrNoSourcesResolved = ErrGetKeySource{"no sources could be resolved"}
// ErrEmptyURL represents an error for when an expected url is an empty string
ErrEmptyURL = ErrGetKeySource{"url cannot be empty"}
// ErrEmptyFilePath represents an error for when an expected file path is an empty string
ErrEmptyFilePath = ErrGetKeySource{"file path cannot be empty"}
)