forked from eksctl-io/eksctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.go
49 lines (42 loc) · 1.27 KB
/
error.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
48
49
package ami
import (
"fmt"
)
// ErrFailedResolution is an error type that represents
// failure to resolve a region/instance type/image family to an AMI
type ErrFailedResolution struct {
region string
version string
instanceType string
imageFamily string
}
// NewErrFailedResolution creates a new instance of ErrFailedResolution for a
// give region, instance type and image family
func NewErrFailedResolution(region, version, instanceType, imageFamily string) *ErrFailedResolution {
return &ErrFailedResolution{
region: region,
version: version,
instanceType: instanceType,
imageFamily: imageFamily,
}
}
// Error return the error message
func (e *ErrFailedResolution) Error() string {
return fmt.Sprintf("unable to determine AMI for region %s, version %s, instance type %s and image family %s", e.region, e.version, e.instanceType, e.imageFamily)
}
// ErrNotFound is an error type that represents
// failure to find a given ami
type ErrNotFound struct {
ami string
}
// NewErrNotFound creates a new instance of ErrNotFound for a
// given ami
func NewErrNotFound(ami string) *ErrNotFound {
return &ErrNotFound{
ami: ami,
}
}
// Error return the error message
func (e *ErrNotFound) Error() string {
return fmt.Sprintf("unable to find AMI %s", e.ami)
}