-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: replace 42 bare excepts with except Exception #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,7 +28,7 @@ async def generate_single_fact_caption( | |||||||||||||||||||||||
| try: | ||||||||||||||||||||||||
| data = json.loads(trajectory_lines[i]) | ||||||||||||||||||||||||
| pyautogui_action = data.get("exec_code") | ||||||||||||||||||||||||
| except: | ||||||||||||||||||||||||
| except Exception: | ||||||||||||||||||||||||
| pass | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if pyautogui_action is None: | ||||||||||||||||||||||||
|
|
@@ -74,7 +74,7 @@ async def generate_fact_captions_parallel( | |||||||||||||||||||||||
| def extract_step_num(filename): | ||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||
| return int(filename.split("_")[1].split(".")[0]) | ||||||||||||||||||||||||
| except: | ||||||||||||||||||||||||
| except Exception: | ||||||||||||||||||||||||
| return 0 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| screenshot_files.sort(key=extract_step_num) | ||||||||||||||||||||||||
|
|
@@ -90,7 +90,7 @@ def extract_step_num(filename): | |||||||||||||||||||||||
| try: | ||||||||||||||||||||||||
| with open(trajectory_file, "r") as f: | ||||||||||||||||||||||||
| trajectory_lines = f.readlines() | ||||||||||||||||||||||||
| except: | ||||||||||||||||||||||||
| except Exception: | ||||||||||||||||||||||||
| pass | ||||||||||||||||||||||||
|
Comment on lines
90
to
94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Silent If 🔧 Proposed fix try:
with open(trajectory_file, "r") as f:
trajectory_lines = f.readlines()
- except Exception:
- pass
+ except OSError as e:
+ print(f"Warning: could not read trajectory file {trajectory_file}: {e}")📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.15.2)[error] 93-94: (S110) [warning] 93-93: Do not catch blind exception: (BLE001) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Use shared semaphore to limit concurrent judge calls | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silent
except Exception: passdiscards diagnostic info — add a log statement.Any failure in
attr_func()(e.g., a COM error or unexpected pyatspi error beyondNotImplementedError) is silently swallowed. Ruff S110 correctly flags this. A debug-level log preserves observability without changing behavior.🔧 Proposed fix
try: attribute_dict[f"{value_key}{attr_name}"] = str(attr_func()) - except Exception: - pass + except Exception as e: + logger.debug("Could not read value attribute %s for node %s: %s", attr_name, node_name, e)📝 Committable suggestion
🧰 Tools
🪛 Ruff (0.15.2)
[error] 672-673:
try-except-passdetected, consider logging the exception(S110)
[warning] 672-672: Do not catch blind exception:
Exception(BLE001)
🤖 Prompt for AI Agents