From 67811e35394bf02ef1af6850dffd6b888c4091ae Mon Sep 17 00:00:00 2001 From: liuweiqing Date: Tue, 3 Sep 2024 12:58:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20throw=20error=E5=AF=BC=E8=87=B4=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 ++-- bypasscf.js | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.env b/.env index 1b65aeba..5c4ce47d 100644 --- a/.env +++ b/.env @@ -3,5 +3,5 @@ USERNAMES=hahaha2,hahaha1,ha1,ha2,DrKBoogieWoogie,lsp,lsb #888存在问题 PASSWORDS="BfdSGt}F4!5pLHt,BfdSGt}F4!5pLHt,iTs9Wx4+3Eavkhk,W$RhQUVn5E?BBBq,]\"w%2Qd%M8Z6-SS,HU5B6Ee]kRB%Qj',uYE)46Ej8phu$#u" # 密码外面要加上双引号,密码内部如果有双引号,需要加上转义字符 反斜杠 \ WEBSITE=https://linux.do # 需要阅读的网站,支持后面那些:https://meta.discourse.org, https://meta.appinn.net, https://community.openai.com RUN_TIME_LIMIT_MINUTES=15 #运行时间,分钟为单位 -TELEGRAM_BOT_TOKEN=yourtoken -TELEGRAM_CHAT_ID=yourid +TELEGRAM_BOT_TOKEN= +TELEGRAM_CHAT_ID= diff --git a/bypasscf.js b/bypasscf.js index e2e3b280..fff63604 100644 --- a/bypasscf.js +++ b/bypasscf.js @@ -77,8 +77,7 @@ function delayClick(time) { try { if (usernames.length !== passwords.length) { console.log(usernames.length, usernames, passwords.length, passwords); - console.log("用户名和密码的数量不匹配!"); - return; + throw new error("用户名和密码的数量不匹配!"); } // 并发启动浏览器实例进行登录 @@ -99,7 +98,7 @@ function delayClick(time) { // 错误处理逻辑 console.error("发生错误:", error); if (token && chatId) { - sendToTelegram(`发生错误:${error.message}`); + sendToTelegram(`${error.message}`); } } })(); @@ -218,7 +217,9 @@ async function launchBrowserForUser(username, password) { }); } } catch (err) { - throw new Error(err); + // throw new Error(err); + console.log("Error:", err); + sendToTelegram(`${err.message}`); } } async function login(page, username, password) {