@suzi.trade/consumer-errors
v0.1.0
Published
Browser-safe Suzi consumer error contract, catalog, and display helpers.
Readme
@suzi.trade/consumer-errors
Browser-safe consumer error contract for Suzi APIs.
This package intentionally contains only DTOs, stable error codes, the public
catalog, runtime type guards, serializers, and display helpers. Backend
classification of upstream failures stays in @suzi/shared.
import {
getConsumerErrorDisplay,
isConsumerErrorEnvelope,
} from '@suzi.trade/consumer-errors';
const body = await response.json();
if (isConsumerErrorEnvelope(body)) {
const display = getConsumerErrorDisplay(body.error);
console.error(display.title, display.message);
}Semver rules:
- Adding a new error code is a minor change.
- Adding optional fields is a minor change.
- Removing, renaming, or changing the meaning of an error code is a major change.
- Message/title copy changes are patch changes unless consumers rely on exact text.
