Skip to content

Commit

Permalink
Changed the error to DomainNotActive for Deprecated domains (cadence-…
Browse files Browse the repository at this point in the history
…workflow#5929)

* OncallFix: Fixed the deprecated error type
  • Loading branch information
abhishekj720 authored Apr 23, 2024
1 parent 3db7157 commit c76970e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions service/frontend/wrappers/clusterredirection/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ func (policy *selectedOrAllAPIsForwardingRedirectionPolicy) WithDomainIDRedirect
return err
}
if domainEntry.IsDeprecatedOrDeleted() {
return fmt.Errorf("domain %v is deprecated or deleted", domainEntry.GetInfo().Name)
return types.DomainNotActiveError{
Message: "domain is deprecated.",
DomainName: domainEntry.GetInfo().Name,
CurrentCluster: policy.currentClusterName,
ActiveCluster: policy.currentClusterName,
}
}
return policy.withRedirect(ctx, domainEntry, apiName, call)
}
Expand All @@ -207,7 +212,12 @@ func (policy *selectedOrAllAPIsForwardingRedirectionPolicy) WithDomainNameRedire
return err
}
if domainEntry.IsDeprecatedOrDeleted() {
return fmt.Errorf("domain %v is deprecated or deleted", domainName)
return types.DomainNotActiveError{
Message: "domain is deprecated or deleted",
DomainName: domainName,
CurrentCluster: policy.currentClusterName,
ActiveCluster: policy.currentClusterName,
}
}
return policy.withRedirect(ctx, domainEntry, apiName, call)
}
Expand Down
4 changes: 2 additions & 2 deletions service/frontend/wrappers/clusterredirection/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ func (s *selectedAPIsForwardingRedirectionPolicySuite) TestGetTargetDataCenter_G
for apiName := range selectedAPIsForwardingRedirectionPolicyAPIAllowlist {
err := s.policy.WithDomainIDRedirect(context.Background(), s.domainID, apiName, callFn)
s.Error(err)
s.Equal(fmt.Sprintf("domain %v is deprecated or deleted", s.domainName), err.Error())
s.Equal("domain is deprecated.", err.Error())

err = s.policy.WithDomainNameRedirect(context.Background(), s.domainName, apiName, callFn)
s.Error(err)
s.Equal(fmt.Sprintf("domain %v is deprecated or deleted", s.domainName), err.Error())
s.Equal("domain is deprecated or deleted", err.Error())
}

s.Equal(0, currentClustercallCount)
Expand Down

0 comments on commit c76970e

Please sign in to comment.