From db036098bcd54b4cc69d018eab6c5225a5834163 Mon Sep 17 00:00:00 2001 From: zhx Date: Tue, 26 May 2026 04:16:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8A=A5=E9=94=99=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/xerr/catalog.go | 2 +- pkg/xerr/grpc_test.go | 8 ++++++++ .../internal/transport/http/response_test.go | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) 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) {