Serialization and API errors
View as MarkdownIdentity
Section titled “Identity”Temporal helpers from @sapporta/shared/temporal, error schema from @sapporta/shared/contracts, and ApiError from @sapporta/shared/client.
Contract
Section titled “Contract”- Calendar dates use ISO
YYYY-MM-DDstrings and parse asTemporal.PlainDateat typed boundaries. - Timestamps use canonical ISO instants and parse as
Temporal.Instantwhere the schema declares them. - HTTP errors carry a stable structured body declared by the contract.
ApiErrorrepresents an HTTP response; network failures remain transport failures rather than fabricated HTTP statuses.- Validation failures and domain failures remain separate declared response branches.
- Expected service/store failures use one typed error family and one route-edge mapping to a declared status and stable body.
- A calling frontend handles the declared
ApiError; unexpected failures remain on the central error path.