修复(#138): 补齐 errMsg 漏掉的错误码映射

为避免业务错误被映射成 "Internal Server Error",补齐
pkg/xerr/errMsg.go 中漏写的 5 个 errCode:

- UserCommissionNotEnough (20010): 佣金余额不足
- SendSmsError            (90002): 短信发送失败
- AreaCodeIsEmpty         (90009): 国家区号不能为空
- DeviceBindLimitExceeded (90019): 设备绑定数量已达上限
- ExistAvailableTraffic   (61005): 存在可用流量

不改动既有条目;不动 errCode.go/errors.go;不改 MapErrMsg 的 fallback 策略。
新增单测覆盖这 5 个码并验证未定义码仍安全 fallback。

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
架构师
2026-06-01 20:17:28 -07:00
parent 750b7be424
commit f7d717f3d8
2 changed files with 51 additions and 0 deletions
+6
View File
@@ -37,6 +37,7 @@ func init() {
TelegramNotBound: "Telegram not bound ",
UserNotBindOauth: "User not bind oauth method",
InviteCodeError: "Invite code error",
UserCommissionNotEnough: "佣金余额不足",
RegisterIPLimit: "Too many registrations",
EmailBindError: "Email already bound",
UserBindInviteCodeExist: "Invite code already bound",
@@ -82,6 +83,8 @@ func init() {
// System error
DebugModeError: "Debug mode is enabled",
SendSmsError: "短信发送失败",
GetAuthenticatorError: "Unsupported login method",
AuthenticatorNotSupportedError: "The authenticator does not support this method",
@@ -94,15 +97,18 @@ func init() {
TelephoneExist: "Telephone already exists",
DeviceExist: "device exists",
PasswordIsEmpty: "password is empty",
AreaCodeIsEmpty: "国家区号不能为空",
TelephoneError: "telephone number error",
DeviceNotExist: "Device does not exist",
UseridNotMatch: "Userid not match",
DeviceBindLimitExceeded: "设备绑定数量已达上限",
// Order error
OrderNotExist: "Order does not exist",
PaymentMethodNotFound: "Payment method not found",
OrderStatusError: "Order status error",
InsufficientOfPeriod: "Insufficient number of period",
ExistAvailableTraffic: "存在可用流量",
OrderAlreadyRefunded: "Order already refunded",
OrderRefundNoSubscription: "Refund target subscription not found",
OrderRefundCommissionMismatch: "Refund commission source not found",