diff --git a/pkg/xerr/catalog.go b/pkg/xerr/catalog.go index d5ee22b9..7ae038f2 100644 --- a/pkg/xerr/catalog.go +++ b/pkg/xerr/catalog.go @@ -57,7 +57,7 @@ var catalog = map[Code]Spec{ DisplayUserIDLeaseExpired: spec(codes.FailedPrecondition, httpStatusConflict, DisplayUserIDLeaseExpired, "conflict"), DisplayUserIDPaymentRequired: spec(codes.FailedPrecondition, httpStatusConflict, DisplayUserIDPaymentRequired, "conflict"), - CountryChangeCooldown: spec(codes.FailedPrecondition, httpStatusConflict, CountryChangeCooldown, "conflict"), + CountryChangeCooldown: spec(codes.FailedPrecondition, httpStatusConflict, CountryChangeCooldown, "country change is cooling down"), CountryNotFound: spec(codes.NotFound, httpStatusNotFound, CountryNotFound, "not found"), RegionNotFound: spec(codes.NotFound, httpStatusNotFound, RegionNotFound, "not found"), RegionCountryConflict: spec(codes.FailedPrecondition, httpStatusConflict, RegionCountryConflict, "conflict"), diff --git a/pkg/xerr/grpc_test.go b/pkg/xerr/grpc_test.go index f18af1b3..41f36d3f 100644 --- a/pkg/xerr/grpc_test.go +++ b/pkg/xerr/grpc_test.go @@ -78,6 +78,14 @@ func TestCatalogMappings(t *testing.T) { publicCode: string(LedgerConflict), publicMessage: "conflict", }, + { + name: "country cooldown keeps actionable app message", + code: CountryChangeCooldown, + grpcCode: codes.FailedPrecondition, + httpStatus: httpStatusConflict, + publicCode: string(CountryChangeCooldown), + publicMessage: "country change is cooling down", + }, } for _, test := range tests { diff --git a/services/gateway-service/internal/transport/http/response_test.go b/services/gateway-service/internal/transport/http/response_test.go index b3256933..e911cbaf 100644 --- a/services/gateway-service/internal/transport/http/response_test.go +++ b/services/gateway-service/internal/transport/http/response_test.go @@ -4028,7 +4028,7 @@ func TestChangeCountryUsesAuthenticatedUserIDAndMapsCooldown(t *testing.T) { router.ServeHTTP(recorder, request) - assertEnvelope(t, recorder, http.StatusConflict, string(xerr.CountryChangeCooldown), "req-country-cooldown") + assertEnvelopeMessage(t, recorder, http.StatusConflict, string(xerr.CountryChangeCooldown), "country change is cooling down", "req-country-cooldown") } func TestChangeCountryRemovesOldRegionBroadcastMember(t *testing.T) {