Skip to content

Commit

Permalink
Check for appropriate DataFederation error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
roothorp committed Aug 7, 2023
1 parent 15d3f05 commit 567347f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/controller/atlas/api_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ const (

// Resource not found
ResourceNotFound = "RESOURCE_NOT_FOUND"

// Instance for the passed {groupId, tenantName} pair does not exist
DataFederationTenantNotFound = "DATA_FEDERATION_TENANT_NOT_FOUND_FOR_NAME"
)
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func managedByAtlas(ctx context.Context, atlasClient mongodbatlas.Client, projec
atlasDataFederation, _, err := atlasClient.DataFederation.Get(ctx, projectID, dataFederation.Spec.Name)
if err != nil {
var apiError *mongodbatlas.ErrorResponse
if errors.As(err, &apiError) && (apiError.ErrorCode == atlas.NotInGroup || apiError.ErrorCode == atlas.ResourceNotFound) {
if errors.As(err, &apiError) && (apiError.ErrorCode == atlas.DataFederationTenantNotFound || apiError.ErrorCode == atlas.ResourceNotFound) {
return false, nil
}
return false, err
Expand Down

0 comments on commit 567347f

Please sign in to comment.