Skip to content

docs: clarify ModelBadRequestError covers any other 4xx - #36

Merged
folathecoder merged 1 commit into
lunarstack-co:mainfrom
zheng-guannan577:fix-agentling-22
Nov 5, 2026
Merged

folathecoder merged 1 commit into
lunarstack-co:mainfrom
zheng-guannan577:fix-agentling-22

Conversation

@zheng-guannan577

Copy link
Copy Markdown
Contributor

Closes #22.

The old docstring only said HTTP 400/404/422, but the three example providers (anthropic/openai/ollama) use a catch-all mapping — after excluding 401/403 (Auth), 429 (RateLimit), 5xx (Server), and body hints for bad-key or over-long prompt, every other 4xx lands in ModelBadRequestError; tests already prove 413 maps there and the README says 'Any other 4xx'.

Local tests passed (PYTHONPATH=src:. python3 -m pytest tests/: 537 passed, 7 skipped, including errors, public_api and three provider mapping test groups with 97 passed; ruff was not installed locally so lint was skipped, and the change is docstring only).

Wording choice: rule-plus-exclusions rather than enumerating roughly 96 status codes one by one, because the mapping itself is catch-all; if the maintainer insists on a literal full list, that is a wording follow-up only, not a behavior change.

Change: docstring only, +9/-1 in src/agentling/errors.py, no behavior code change.

@folathecoder
folathecoder self-requested a review November 5, 2026 16:22
@folathecoder folathecoder added the enhancement New feature or request label Nov 5, 2026
@folathecoder

Copy link
Copy Markdown
Collaborator

@zheng-guannan577 Looks great. Can you optionally star the project to support?

@folathecoder
folathecoder merged commit 357b06e into lunarstack-co:main Nov 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ModelBadRequestError's docstring lists only 400, 404 and 422

2 participants