Files
clydeRbuegel 060712a287 fix: report backend errors without a traceback and keep --json parsable (#439)
`main()` called `cli()` without any error handling, so a failure to reach the
AdGuardHome API surfaced as a chained urllib3/requests/click traceback. In
`--json` mode nothing at all was written to stdout, leaving an agent with no
parsable result.

The Docker hint inside that error message also mapped the host port to itself
(`-p 3001:3001`), which cannot reach a fresh container: the image serves its web
interface on container port 3000, as the harness's own E2E fixture and README
already assume.

- catch RuntimeError and requests exceptions in `main()`: emit
  `{"error": ...}` on stdout with `--json`, the plain message on stderr
  otherwise, exit 1 in both cases
- map the Docker hint to container port 3000 and mention that the wizard must
  keep the web interface there
- cover both paths with tests: JSON shape and exit status on an unreachable
  host, plain-message path on stderr, and the port mapping in the hint

Fixes #437


Claude-Session: https://claude.ai/code/session_01ChPxA9ksnNqr83nLbfMhwu

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 15:23:44 +08:00
..