feat: 增强注册流程,处理用户已存在错误,更新相关逻辑和测试用例

This commit is contained in:
QLHazyCoder
2026-04-20 15:08:45 +08:00
parent d17ac3afde
commit 4107e4d378
11 changed files with 417 additions and 3 deletions
+15 -1
View File
@@ -70,8 +70,9 @@
? routeErrorPattern.test(text)
: false;
const maxCheckAttemptsBlocked = /max_check_attempts/i.test(text);
const userAlreadyExistsBlocked = /user_already_exists/i.test(text);
if (!titleMatched && !detailMatched && !routeErrorMatched && !maxCheckAttemptsBlocked) {
if (!titleMatched && !detailMatched && !routeErrorMatched && !maxCheckAttemptsBlocked && !userAlreadyExistsBlocked) {
return null;
}
@@ -84,6 +85,7 @@
detailMatched,
routeErrorMatched,
maxCheckAttemptsBlocked,
userAlreadyExistsBlocked,
};
}
@@ -153,6 +155,12 @@
);
}
if (retryState.userAlreadyExistsBlocked) {
throw new Error(
'SIGNUP_USER_ALREADY_EXISTS::步骤 4:检测到 user_already_exists,说明当前用户已存在,当前轮将直接停止。'
);
}
if (retryState.retryButton && retryState.retryEnabled) {
idlePollCount = 0;
clickCount += 1;
@@ -204,6 +212,12 @@
);
}
if (finalRetryState.userAlreadyExistsBlocked) {
throw new Error(
'SIGNUP_USER_ALREADY_EXISTS::步骤 4:检测到 user_already_exists,说明当前用户已存在,当前轮将直接停止。'
);
}
throw new Error(
`${logLabel || `步骤 ${step || '?'}:重试页恢复`}失败:已连续点击“重试” ${maxClickAttempts} 次,页面仍未恢复。URL: ${location.href}`
);