forked from convox/rack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.go
32 lines (25 loc) · 759 Bytes
/
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
package aws
import "fmt"
// errorNotFound means the requested item was not found
type errorNotFound string
// Error satisfies the error interface
func (e errorNotFound) Error() string {
return string(e)
}
// NotFound defines the behavior of this error
func (e errorNotFound) NotFound() bool {
return true
}
// ErrorNotFound returns true if the error is a "not found" type
func ErrorNotFound(err error) bool {
if e, ok := err.(errorNotFound); ok && e.NotFound() {
return true
}
return false
}
// NoSuchBuild means the requested build id was not found
type NoSuchBuild string
// Error satisfies the Error interface and formats the return error goven id
func (id NoSuchBuild) Error() string {
return fmt.Sprintf("no such build: %s", string(id))
}