style: fix bare except Exception clauses (closes #74)#77
Open
sjhddh wants to merge 1 commit intoHKUDS:mainfrom
Open
style: fix bare except Exception clauses (closes #74)#77sjhddh wants to merge 1 commit intoHKUDS:mainfrom
sjhddh wants to merge 1 commit intoHKUDS:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #74 by updating multiple Python harnesses to bind caught Exception instances (except Exception as e:) instead of using bare except Exception: with the stated goal of improving debuggability.
Changes:
- Replaced
except Exception:withexcept Exception as e:in several REPL/demo paths. - Updated some auth/login flows to bind exceptions during “best effort” user-info verification.
- Updated image-dimension probing fallback to bind exceptions when PIL/image parsing fails.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| zoom/agent-harness/cli_anything/zoom/zoom_cli.py | Binds exceptions in REPL auth status/context lookup paths. |
| zoom/agent-harness/cli_anything/zoom/core/auth.py | Binds exceptions during user info verification in login flows. |
| shotcut/agent-harness/workflow_demo.py | Binds exceptions when counting filters in the demo workflow. |
| obs-studio/agent-harness/cli_anything/obs_studio/obs_studio_cli.py | Binds exceptions while computing project name for REPL prompt. |
| libreoffice/agent-harness/cli_anything/libreoffice/libreoffice_cli.py | Binds exceptions in REPL prompt helpers (project name / modified flag). |
| inkscape/agent-harness/cli_anything/inkscape/inkscape_cli.py | Binds exceptions while computing project name for REPL prompt. |
| gimp/agent-harness/cli_anything/gimp/gimp_cli.py | Binds exceptions in REPL project name lookup. |
| gimp/agent-harness/cli_anything/gimp/core/layers.py | Binds exceptions during PIL-based image dimension probing fallback. |
Comments suppressed due to low confidence (1)
zoom/agent-harness/cli_anything/zoom/core/auth.py:141
except Exception as e:bindsebut the exception is not used. If the goal is improved debuggability, consider includingstr(e)in the returned dict (e.g., anerror/detailsfield) or logging it; otherwise bind to_instead.
except Exception as e:
return {
"status": "logged_in",
"message": "Tokens saved. Could not verify user info.",
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| except Exception: | ||
| except Exception as e: | ||
| return {"status": "logged_in", "message": "Tokens saved."} |
Comment on lines
+687
to
688
| except Exception as e: | ||
| return False |
| if s.has_project(): | ||
| return s.project_path or "untitled" | ||
| except Exception: | ||
| except Exception as e: |
| p = sess.get_project() | ||
| proj_name = p.get("name", "") if isinstance(p, dict) else "" | ||
| except Exception: | ||
| except Exception as e: |
Comment on lines
+467
to
468
| except Exception as e: | ||
| skin.info("Run 'auth setup' to configure OAuth credentials.") |
| f = filt_mod.list_filters(session, track["index"], c["clip_index"]) | ||
| filter_count += len(f) | ||
| except Exception: | ||
| except Exception as e: |
| info = proj_mod.get_project_info(sess.get_project()) | ||
| return info.get("name", "") | ||
| except Exception: | ||
| except Exception as e: |
Comment on lines
+679
to
681
| except Exception as e: | ||
| pass | ||
| return "" |
| with Image.open(path) as img: | ||
| w, h = img.size | ||
| except Exception: | ||
| except Exception as e: |
Comment on lines
+476
to
477
| except Exception as e: | ||
| context = "" |
Contributor
|
Only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes issue #74 by replacing bare
except Exception:withexcept Exception as e:across all harnesses to align with Python best practices and improve debuggability.(Code refactoring executed using the newly open-sourced 0-editor)