-
Notifications
You must be signed in to change notification settings - Fork 1
/
errors.go
39 lines (30 loc) · 1.03 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 terra
import "fmt"
type ErrWithCmdOutput struct {
Underlying error
Output *output
}
func (e *ErrWithCmdOutput) Error() string {
return fmt.Sprintf("error while running command: %v; %s", e.Underlying, e.Output.Stderr())
}
// MaxRetriesExceeded is an error that occurs when the maximum amount of retries is exceeded.
type MaxRetriesExceeded struct {
Description string
MaxRetries int
}
func (err MaxRetriesExceeded) Error() string {
return fmt.Sprintf("'%s' unsuccessful after %d retries", err.Description, err.MaxRetries)
}
// FatalError is a marker interface for errors that should not be retried.
type FatalError struct {
Underlying error
}
func (err FatalError) Error() string {
return fmt.Sprintf("FatalError{Underlying: %v}", err.Underlying)
}
// OutputKeyNotFound occurs when terraform output does not contain a value for the key
// specified in the function call
type OutputKeyNotFound string
func (err OutputKeyNotFound) Error() string {
return fmt.Sprintf("output doesn't contain a value for the key %q", string(err))
}