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
110 lines (89 loc) · 2.04 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
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 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
}
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
}