π·οΈ v1.0.0 β Initial release
β¨ What this is
@twinedo/app-error is a small, framework-agnostic library that normalizes
errors from fetch, axios-like clients, and unknown runtime errors into a single, predictable AppError model.
Itβs designed for projects where:
- Different backends return different error shapes
- HTTP clients behave differently
- Teams want consistent UI messaging, retry logic, and logging inputs
π¦ Included in this release
Core API
-
toAppError(error, policy?)
Normalize any thrown value into a predictable AppError -
fromFetch(response, body?, policy?)
Convert non-OK fetch responses into AppError -
defineErrorPolicy(config)
Configure backend-specific error extraction rules -
isAppError(value)
Type guard for normalized errors -
errorKey(error)
Stable fingerprint for deduping and logging -
isRetryable(error)
Centralized retry decision helper -
attempt(fn)
Safe execution helper returning { ok, data | error }
β Guarantees
This release guarantees that:
- Normalization never throws
- Output shape is always predictable
messageis always safe to display in UI- Original errors are preserved via
cause - No input error is mutated
- Fully TypeScript-friendly
- Framework-agnostic (React, React Native, Vue, Angular, Node)
π« Non-Goals
This library intentionally does not:
- Perform logging, reporting, or analytics
- Display UI or toast notifications
- Guess backend-specific error schemas
- Replace HTTP clients like fetch or axios
- Enforce localization or translations
- Hide or swallow errors silently
π¦ Status
This is an initial release (v0.1.0).
- The public API is intentionally small and stable
- Feedback and real-world use cases are welcome before moving toward v1.0
π Links
- npm: https://www.npmjs.com/package/@twinedo/app-error
- Repository: https://github.com/twinedo/app-error
π Thank you
Thanks for checking out the project!
If you find issues or have suggestions, please open an issue or discussion.