-
Notifications
You must be signed in to change notification settings - Fork 50
/
errors.go
47 lines (37 loc) · 1.09 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
40
41
42
43
44
45
46
47
package ostree
import "fmt"
// ResolveRefError is returned when there is a failure to resolve the
// reference.
type ResolveRefError struct {
msg string
}
func (e ResolveRefError) Error() string {
return e.msg
}
// NewResolveRefError creates and returns a new ResolveRefError with a given
// formatted message.
func NewResolveRefError(msg string, args ...interface{}) ResolveRefError {
return ResolveRefError{msg: fmt.Sprintf(msg, args...)}
}
// RefError is returned when a parameter is invalid (e.g., malformed
// or contains illegal characters).
type RefError struct {
msg string
}
func (e RefError) Error() string {
return e.msg
}
// NewRefError creates and returns a new InvalidParameterError
// with a given formatted message.
func NewRefError(msg string, args ...interface{}) RefError {
return RefError{msg: fmt.Sprintf(msg, args...)}
}
type ParameterComboError struct {
msg string
}
func (e ParameterComboError) Error() string {
return e.msg
}
func NewParameterComboError(msg string, args ...interface{}) ParameterComboError {
return ParameterComboError{msg: fmt.Sprintf(msg, args...)}
}