fix: replace bare except with Exception in oauth.py (#22420)
* fix: replace bare except with except Exception in main.py * fix: replace bare except with Exception in oauth.py In Python 3, bare 'except:' is discouraged as it catches all SystemExit and KeyboardInterrupt exceptions. Changed to 'except Exception:' to only catch actual exceptions.
This commit is contained in:
@@ -1864,7 +1864,7 @@ async def chat_completion(
|
|||||||
"model": model_id,
|
"model": model_id,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
ctx = build_chat_response_context(
|
ctx = build_chat_response_context(
|
||||||
@@ -1911,7 +1911,7 @@ async def chat_completion(
|
|||||||
{"type": "chat:tasks:cancel"},
|
{"type": "chat:tasks:cancel"},
|
||||||
)
|
)
|
||||||
|
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ class OAuthClientManager:
|
|||||||
payload = json.loads(response_text)
|
payload = json.loads(response_text)
|
||||||
error = payload.get("error")
|
error = payload.get("error")
|
||||||
error_description = payload.get("error_description", "")
|
error_description = payload.get("error_description", "")
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
error_description = response_text
|
error_description = response_text
|
||||||
|
|||||||
Reference in New Issue
Block a user