File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
2020 "fmt"
2121 "os"
2222 "time"
23+ "net/http"
2324)
2425
2526// Client represents an IBM Cloud API client
@@ -127,23 +128,23 @@ func (c *Client) VPCInstanceExists(ctx context.Context, instanceID string) (bool
127128 return true , nil
128129}
129130
130- // containsNotFoundError checks if an error indicates a resource was not found
131131func containsNotFoundError (err error ) bool {
132- if err == nil {
133- return false
134- }
135-
136- errStr := err .Error ()
137- // Check for common "not found" error patterns from IBM Cloud VPC API
138- return containsAnyString (errStr , []string {
139- "not found" ,
140- "404" ,
141- "Not Found" ,
142- "does not exist" ,
143- "cannot be found" ,
144- })
132+ if err == nil {
133+ return false
134+ }
135+
136+ errStr := err .Error ()
137+ // Check for common "not found" error patterns from IBM Cloud VPC API
138+ return containsAnyString (errStr , []string {
139+ "not found" ,
140+ fmt . Sprintf ( "%d" , http . StatusNotFound ), // 404
141+ "Not Found" ,
142+ "does not exist" ,
143+ "cannot be found" ,
144+ })
145145}
146146
147+
147148// containsAnyString checks if a string contains any of the specified substrings
148149func containsAnyString (s string , substrings []string ) bool {
149150 for _ , substring := range substrings {
You can’t perform that action at this time.
0 commit comments