Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b3d9d86

Browse files
committed
chore(release): release zodiac-core 0.9.1
- Bump package and lockfile versions to 0.9.1 - Add changelog and API docs for upstream error details
1 parent cb0406e commit b3d9d86

4 files changed

Lines changed: 45 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.9.1] - 2026-06-02
9+
10+
### Added
11+
12+
- **HTTP**: Log translated upstream HTTP errors with structured context, including service, error type, request method, upstream URL, status code, and capped upstream response body details.
13+
- **Exceptions**: Include upstream status and response body details in `UpstreamRequestException` responses for upstream HTTP 400/422 failures.
14+
15+
### Fixed
16+
17+
- **HTTP**: Handle `httpx.RequestError` instances without request metadata without raising a secondary exception during upstream error translation.
18+
- **Exception Handlers**: Log inbound request context when returning standardized upstream error responses.
19+
- **Docs**: Document upstream error logging fields and 400/422 response details.
20+
821
## [0.9.0] - 2026-04-29
922

1023
### Added

docs/api/exceptions.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,35 @@ Classification:
9090
- Other upstream HTTP status failures become `UpstreamServiceException`.
9191
- Other `httpx.RequestError` failures become `UpstreamServiceException`.
9292

93+
When an upstream HTTP status error is translated, ZodiacCore logs a warning with structured upstream context:
94+
95+
- `upstream_service`
96+
- `upstream_error_type`
97+
- `upstream_method` and `upstream_url` when request metadata is available
98+
- `upstream_status`
99+
- `upstream_response_body`
100+
- `upstream_response_body_truncated`
101+
102+
The response body logged in `upstream_response_body` is capped at 4096 characters. If the upstream response body has not been read, ZodiacCore logs `"<response body not read>"` instead of consuming the stream. `httpx.RequestError` instances without request metadata are still translated and logged without method or URL fields.
103+
104+
For upstream HTTP 400/422 failures, the standard response also includes the upstream status and response body details so callers can diagnose rejected upstream requests:
105+
106+
```json
107+
{
108+
"code": 400,
109+
"message": "Upstream request failed",
110+
"data": {
111+
"service": "identity_and_access",
112+
"error_code": "UPSTREAM_REQUEST_ERROR",
113+
"upstream_status": 422,
114+
"upstream_response_body": "{\"code\":422}",
115+
"upstream_response_body_truncated": false
116+
}
117+
}
118+
```
119+
120+
For other upstream HTTP status failures, the upstream response body is logged but not returned in the client response.
121+
93122
Some upstream services always return HTTP 200 and put business failures in their response body. In that case, parse the upstream payload and raise the ZodiacCore upstream exception yourself:
94123

95124
```python
@@ -107,6 +136,7 @@ async def create_payment(client: ZodiacClient):
107136
raise UpstreamRequestException(
108137
service="payment_gateway",
109138
upstream_status=response.status_code,
139+
upstream_response_body=response.text,
110140
)
111141

112142
if payload["code"] != "SUCCESS":

pyproject.toml

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

55
[project]
66
name = "zodiac-core"
7-
version = "0.9.0"
7+
version = "0.9.1"
88
description = "ZodiacCore-Py: A high-performance core library for modern Python web services."
99
readme = "README.md"
1010
license = "MIT"

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)