修复报错信息

This commit is contained in:
zhx 2026-05-26 04:16:58 +08:00
parent 463c208640
commit db036098bc
3 changed files with 10 additions and 2 deletions

View File

@ -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"),

View File

@ -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 {

View File

@ -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) {