Skip to content

Commit 61bbb99

Browse files
authored
fix: replace bare except with Exception in oauth.py (open-webui#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.
1 parent 124ad94 commit 61bbb99

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

backend/open_webui/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@ async def process_chat(request, form_data, user, metadata, model):
18641864
"model": model_id,
18651865
},
18661866
)
1867-
except:
1867+
except Exception:
18681868
pass
18691869

18701870
ctx = build_chat_response_context(
@@ -1911,7 +1911,7 @@ async def process_chat(request, form_data, user, metadata, model):
19111911
{"type": "chat:tasks:cancel"},
19121912
)
19131913

1914-
except:
1914+
except Exception:
19151915
pass
19161916
finally:
19171917
try:

backend/open_webui/utils/oauth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ async def _preflight_authorization_url(
620620
payload = json.loads(response_text)
621621
error = payload.get("error")
622622
error_description = payload.get("error_description", "")
623-
except:
623+
except Exception:
624624
pass
625625
else:
626626
error_description = response_text

0 commit comments

Comments
 (0)