feat: include platformCode in error responses (v0.10.0) (#1)

- Error(w, err) now extracts PlatformCode() from *xerrors.Err and
  includes "platformCode" in the JSON body when set; omitted otherwise
- errorBody updated to accept platformCode as an explicit parameter
- Upgraded code.nochebuena.dev/go/xerrors dependency to v0.10.0
- Added two new tests: platformCode included when set, omitted when absent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Reviewed-on: #1
Reviewed-by: Rene Nochebuena <rene@noreply.nochebuena.dev>
Co-authored-by: Claude Code <claude@nochebuena.dev>
Co-committed-by: Claude Code <claude@nochebuena.dev>
This commit was merged in pull request #1.
This commit is contained in:
2026-03-25 16:57:49 -06:00
committed by NOCHEBUENADEV
parent 285293a75b
commit 8d34a0c715
5 changed files with 47 additions and 6 deletions

View File

@@ -5,6 +5,20 @@ All notable changes to this module will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this module adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.10.0] - 2026-03-25
### Changed
- `Error(w http.ResponseWriter, err error)` — now includes `"platformCode"` in the JSON error body when the `*xerrors.Err` carries one; omitted otherwise
- Upgraded `code.nochebuena.dev/go/xerrors` dependency to `v0.10.0`
### Design Notes
- `platformCode` is the domain-layer error identifier introduced in `xerrors` v0.10.0. It travels through `Error` transparently — no transport-layer logic depends on it.
- Backwards-compatible: error responses without a platform code are identical to v0.9.0.
[0.10.0]: https://code.nochebuena.dev/go/httputil/compare/v0.9.0...v0.10.0
## [0.9.0] - 2026-03-18
### Added