/
error.go
37 lines (31 loc) · 969 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
33
34
35
36
37
package tccpnatgateways
import (
"github.com/giantswarm/microerror"
"k8s.io/apimachinery/pkg/api/errors"
)
// executionFailedError is an error type for situations where Resource execution
// cannot continue and must always fall back to operatorkit.
//
// This error should never be matched against and therefore there is no matcher
// implement. For further information see:
//
// https://github.com/giantswarm/fmt/blob/master/go/errors.md#matching-errors
//
var executionFailedError = µerror.Error{
Kind: "executionFailedError",
}
var invalidConfigError = µerror.Error{
Kind: "invalidConfigError",
}
// IsInsserts invalidConfigError.
func IsInvalidConfig(err error) bool {
return microerror.Cause(err) == invalidConfigError
}
var notFoundError = µerror.Error{
Kind: "notFoundError",
}
// IsNotFound asserts notFoundError.
func IsNotFound(err error) bool {
c := microerror.Cause(err)
return c == notFoundError || errors.IsNotFound(c)
}