diff --git a/main.py b/main.py index 77e1dd8..1ce1ca4 100644 --- a/main.py +++ b/main.py @@ -366,7 +366,7 @@ def main(driver: WebDriver): clean = True attempt += 1 request = get_request() - tell('[信息] 正在发送:%s (%.2f %%)' % (recipient, current / limit * 100)) + tell('正在发送:%s (%.2f %%)' % (recipient, current / limit * 100)) if (target := get_address()) != address: exception = Exception(f'邮件发件地址与设定不一致\n>> {address}\n>> {target}') @@ -476,12 +476,11 @@ def main(driver: WebDriver): break except Faillable as o: request = o.request - except (KeyboardInterrupt, ShutDown, InvalidSessionIdException) as e: - tell('程序中断', e, level=1) - status = Status.TERMINATED - break except Exception as e: tell(f'发生错误 ({attempt})', e, level=0) + if connection.closed or isinstance(e, KeyboardInterrupt): + status = Status.TERMINATED + break outbox.put(Command('setStatus', 'FAILED')) request = inbox.get() @@ -496,7 +495,7 @@ def main(driver: WebDriver): status = Status.INACTIVE progress = cursor / limit * 100 - tell('[信息] 当前进度:%.2f %%' % progress) + tell('当前进度:%.2f %%' % progress) tell(f'已发送 {sent} 封;发送失败 {errors} 封;跳过重复项 {warnings} 个') if parameters.get('save'):