Skip to content
This repository was archived by the owner on Feb 26, 2026. It is now read-only.

Commit cb452e7

Browse files
committed
Returns immediately on failure to signin
1 parent bd6e252 commit cb452e7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

msreward/msr.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,22 @@ def _start_browser(self, user_agent: str, log_in: bool = False) -> None:
2929
self.account = MSRAccount(self.browser, self.email, self.pswd, self.opt_secret)
3030
self.worker = MSRWorker(self.browser, self.account)
3131
if log_in:
32-
self.account.log_in()
32+
try:
33+
self.account.log_in()
34+
except Exception:
35+
logging.error(msg=f'{"Failed to sign in. An error has occurred."}', exc_info=True)
36+
return False
37+
return True
3338

3439
def _quit_browser(self) -> None:
3540
if self.browser:
3641
self.browser.quit()
3742

3843
def work(self, flag_pc: bool, flag_mob: bool, flag_quiz: bool) -> None:
3944
ua = PC_USER_AGENT if flag_pc or flag_quiz else MOBILE_USER_AGENT
40-
self._start_browser(ua, log_in=True)
45+
if not self._start_browser(ua, log_in=True):
46+
logging.info('Fail to initiate.')
47+
return
4148

4249
summary = self.account.get_summary(log=True)
4350
if summary.all_done:

0 commit comments

Comments
 (0)