Skip to content

style: fix bare except Exception clauses (closes #74)#77

Open
sjhddh wants to merge 1 commit intoHKUDS:mainfrom
sjhddh:fix-bare-excepts
Open

style: fix bare except Exception clauses (closes #74)#77
sjhddh wants to merge 1 commit intoHKUDS:mainfrom
sjhddh:fix-bare-excepts

Conversation

@sjhddh
Copy link
Contributor

@sjhddh sjhddh commented Mar 15, 2026

This PR fixes issue #74 by replacing bare except Exception: with except 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)

Copilot AI review requested due to automatic review settings March 15, 2026 07:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: with except 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: binds e but the exception is not used. If the goal is improved debuggability, consider including str(e) in the returned dict (e.g., an error/details field) 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 = ""
@sehawq
Copy link
Contributor

sehawq commented Mar 15, 2026

Only except Exception: -> except Exception as e: changes. If debuggability is the goal, use e in a log: otherwise _ is clearer. No functional changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants