Skip to content

Commit d4ba874

Browse files
authored
Merge pull request kubernetes-sigs#650 from mboersma/delete-the-deleted
🐛 Check all chained errors for 404
2 parents 09459f7 + 214c0d7 commit d4ba874

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cloud/errors.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ limitations under the License.
1717
package azure
1818

1919
import (
20+
"errors"
21+
2022
"github.com/Azure/go-autorest/autorest"
2123
)
2224

2325
// ResourceNotFound parses the error to check if it's a resource not found
2426
func ResourceNotFound(err error) bool {
25-
if derr, ok := err.(autorest.DetailedError); ok && derr.StatusCode == 404 {
26-
return true
27-
}
28-
return false
27+
derr := autorest.DetailedError{}
28+
return errors.As(err, &derr) && derr.StatusCode == 404
2929
}

0 commit comments

Comments
 (0)