Skip to content

fix: Report Docker and installed-command errors as a short message - #70

Merged
nealrichardson merged 3 commits into
mainfrom
clean-errors
Oct 23, 2026
Merged

nealrichardson merged 3 commits into
mainfrom
clean-errors

Conversation

@nealrichardson

@nealrichardson nealrichardson commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #59. Fixes #61.

#61: installed with-connect prints a traceback

The installed command called main() directly, which skipped the code that turns errors into a short message. main() is now the only entry point: it runs the workflow (renamed to run()), prints RuntimeErrors as a one-line Error: ..., and exits with code 1. Both the console script (pyproject.toml) and python main.py call main().

#59: Docker errors print a traceback

These Docker failures are reported as one-line errors:

  • Docker unreachable (for example, the daemon isn't running): Could not connect to Docker. Is it running? ...
  • Container create fails, including client timeouts and 400 Bad Requests
  • Container start fails (for example, the port is already allocated). The container is created and started in separate steps, so a container that fails to start is removed.
  • --stop fails with a Docker error other than "not found"

If stopping the container fails during cleanup after a run, with-connect prints a warning and keeps the original error or the command's exit code.

Tests

Added unit tests for each failure path, plus a check that the console script points at main:main. They're also registered in the __main__ block so uv run test_main.py in CI runs them. I checked the installed command by hand against real Docker for --stop without a container ID, an unreachable DOCKER_HOST, and a port already in use, which left no container behind.

The branch is rebased onto main, including #69, #71, #74, and #75.

🤖 Generated with Claude Code

Comment thread main.py Outdated


if __name__ == "__main__":
def cli() -> None:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't like how we have a function called main() (and see its docstring), but __main__ calls cli(). Sounds like we need some renaming at least, possibly refactoring.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Renamed so main() is the entry point (console script, python main.py, and the error reporting), and the workflow it calls is run(). The console script is main:main again, the same as on main. (2f9b025)

nealrichardson and others added 3 commits October 23, 2026 14:38
…sage

The installed with-connect command calls cli(), which prints RuntimeErrors
as a one-line Error: message, as python main.py already did. Failures to
reach Docker, create the container, or start it are reported the same way,
and a container that fails to start is removed.

Fixes #59. Fixes #61.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--stop reports a short error, and a failed stop during cleanup prints a
warning instead of hiding the original error or exit code. Addresses
roborev job 680.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nealrichardson
nealrichardson merged commit 2a28429 into main Oct 23, 2026
13 checks passed
@nealrichardson
nealrichardson deleted the clean-errors branch October 23, 2026 19:06
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.

Installed with-connect shows a traceback instead of a short error Container creation errors crash with a raw traceback instead of a clear message

1 participant