This repository has been archived by the owner on Nov 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
error.go
128 lines (103 loc) · 2.46 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package masters
import (
"github.com/Azure/go-autorest/autorest"
"github.com/giantswarm/microerror"
)
var clientNotFoundError = µerror.Error{
Kind: "clientNotFoundError",
}
// IsClientNotFound asserts clientNotFoundError.
func IsClientNotFound(err error) bool {
return microerror.Cause(err) == clientNotFoundError
}
// 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",
}
// IsInvalidConfig asserts invalidConfigError.
func IsInvalidConfig(err error) bool {
return microerror.Cause(err) == invalidConfigError
}
var deploymentNotFoundError = µerror.Error{
Kind: "deploymentNotFoundError",
}
// IsDeploymentNotFound asserts deploymentNotFoundError.
func IsDeploymentNotFound(err error) bool {
if err == nil {
return false
}
c := microerror.Cause(err)
if c == deploymentNotFoundError {
return true
}
{
dErr, ok := c.(autorest.DetailedError)
if ok {
if dErr.StatusCode == 404 {
return true
}
}
}
return false
}
var missingLabelError = µerror.Error{
Kind: "missingLabelError",
}
// IsMissingLabel asserts missingLabelError.
func IsMissingLabel(err error) bool {
return microerror.Cause(err) == missingLabelError
}
func IsNotFound(err error) bool {
if err == nil {
return false
}
{
c := microerror.Cause(err)
dErr, ok := c.(autorest.DetailedError)
if ok {
if dErr.StatusCode == 404 {
return true
}
}
}
return false
}
var scaleSetNotFoundError = µerror.Error{
Kind: "scaleSetNotFoundError",
}
// IsScaleSetNotFound asserts scaleSetNotFoundError.
func IsScaleSetNotFound(err error) bool {
if err == nil {
return false
}
c := microerror.Cause(err)
if c == scaleSetNotFoundError {
return true
}
{
dErr, ok := c.(autorest.DetailedError)
if ok {
if dErr.StatusCode == 404 {
return true
}
}
}
return false
}
var versionBlobEmptyError = µerror.Error{
Kind: "versionBlobEmptyError",
}
// IsVersionBlobEmpty asserts versionBlobEmptyError.
func IsVersionBlobEmpty(err error) bool {
return microerror.Cause(err) == versionBlobEmptyError
}