feat: include platformCode in error responses (v0.10.0) #1
Reference in New Issue
Block a user
Delete Branch "feature/platform-code"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Error(w, err)now extractsPlatformCode()from*xerrors.Errand includes"platformCode"in the JSON error body when set; omitted when not set (backwards-compatible)errorBodyupdated to acceptplatformCodeas an explicit parametercode.nochebuena.dev/go/xerrorsdependency tov0.10.0TestError_PlatformCode_IncludedWhenSet,TestError_PlatformCode_OmittedWhenNotSetError response shape
With platform code:
Without platform code (unchanged from v0.9.0):
Motivation
Frontend teams need a stable, transport-agnostic identifier for domain errors to drive i18n message lookup.
Codeis transport-bounded (ErrNotFound→ 404);platformCodeis open-ended and domain-specific. The transport layer passes it through transparently — no mapping logic added here.Test plan
go test ./...passesTestError_PlatformCode_IncludedWhenSet— 404 response containsplatformCode: "EMPLOYEE_NOT_FOUND"TestError_PlatformCode_OmittedWhenNotSet— response body has noplatformCodekey🤖 Generated with Claude Code
LGTM