Skip to content

Commit b330571

Browse files
vvillait88claude
andauthored
Release 2.4.2: align assess() default error message (#33)
## Summary - **`assess()`/`aassess()` default error message**: when the API response omits `error.message`, the SDK now surfaces `"Request failed with status N"` (was the raw response body); the raw JSON body is still preserved in `details`. Brings the python client in line with the node client. - **version → 2.4.2** (lockstep with `@agent-score/sdk`). ## Test plan - [x] `uv run ruff check` clean - [x] `uv run ty check` clean - [x] `uv run pytest --cov-branch` — **100% branch**, 176 passed - [x] e2e: consumers (core/store + node merchants via commerce) unaffected; no consumer asserts on the error message Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a9c8876 commit b330571

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎agentscore/client.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ def _build_error_from_response(response: httpx.Response) -> AgentScoreError:
9393
dedicated subclass for.
9494
"""
9595
code = "unknown_error"
96-
message = response.text
96+
# Concise default, overridden by ``error.message`` when the body carries one. The raw
97+
# body, when it is JSON, is preserved in ``details`` below.
98+
message = f"Request failed with status {response.status_code}"
9799
details: dict[str, Any] = {}
98100

99101
try:

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "agentscore-py"
7-
version = "2.4.1"
7+
version = "2.4.2"
88
description = "Python client for the AgentScore APIs"
99
readme = "README.md"
1010
license = "MIT"

‎tests/test_client.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2219,7 +2219,7 @@ async def test_aassess_connect_error_wraps_to_network_error():
22192219
@respx.mock
22202220
def test_error_body_non_dict_json_falls_through_to_defaults():
22212221
"""When the error body parses to JSON that is NOT a dict (e.g. a list), the SDK keeps
2222-
code='unknown_error' and message=response.text rather than crashing."""
2222+
code='unknown_error' and a status-based default message rather than crashing."""
22232223
respx.post(f"{BASE_URL}/v1/assess").mock(
22242224
return_value=httpx.Response(500, json=["oops", "not", "a", "dict"]),
22252225
)

‎uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)