mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-21 14:17:11 +08:00
fix: replace bare except clauses with except Exception
Bare `except:` catches BaseException including KeyboardInterrupt and SystemExit. Replaced 29 instances with `except Exception:`.
This commit is contained in:
@@ -82,7 +82,7 @@ def check_file(fileDir):
|
||||
with open(fileDir):
|
||||
pass
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def print_qr(fileDir):
|
||||
@@ -133,7 +133,7 @@ def test_connect(retryTime=5):
|
||||
try:
|
||||
r = requests.get(config.BASE_URL)
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
if i == retryTime - 1:
|
||||
logger.error(traceback.format_exc())
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user