cli.py: main() has no exception handling — raw tracebacks to user #141

Closed
opened 2026-07-06 06:46:08 +00:00 by the.auditor · 0 comments
Owner

src/hottea/cli.pymain() runs the full pipeline without any exception handling. If any step fails (config missing, git repo invalid, Forgejo API down), the user gets a raw Python traceback instead of a clean error message.

Known exceptions that should be caught:

  • ConfigError (missing env vars)
  • InvalidRepoError, GitRepoError (git issues)
  • ForgejoAuthError, ForgejoNotFoundError, ForgejoError (API issues)

Recommendation: wrap the pipeline body in a try/except:

def main() -> None:
    try:
        ...pipeline...
    except ConfigError as e:
        logger.error("Configuration error: %s", e)
        sys.exit(1)
    except (GitRepoError, InvalidRepoError) as e:
        logger.error("Repository error: %s", e)
        sys.exit(1)
    except ForgejoError as e:
        logger.error("Forgejo API error: %s", e)
        sys.exit(1)

Ref: PR #140

`src/hottea/cli.py` — `main()` runs the full pipeline without any exception handling. If any step fails (config missing, git repo invalid, Forgejo API down), the user gets a raw Python traceback instead of a clean error message. Known exceptions that should be caught: - `ConfigError` (missing env vars) - `InvalidRepoError`, `GitRepoError` (git issues) - `ForgejoAuthError`, `ForgejoNotFoundError`, `ForgejoError` (API issues) Recommendation: wrap the pipeline body in a try/except: ```python def main() -> None: try: ...pipeline... except ConfigError as e: logger.error("Configuration error: %s", e) sys.exit(1) except (GitRepoError, InvalidRepoError) as e: logger.error("Repository error: %s", e) sys.exit(1) except ForgejoError as e: logger.error("Forgejo API error: %s", e) sys.exit(1) ``` Ref: PR #140
fuzzy closed this issue 2026-07-06 09:07:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/hottea#141
No description provided.