Initial Commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
---
|
||||
name: error
|
||||
description: Use when implementing or debugging code that uses @suaveplan/error: Foundation error substrate — SuaveplanError base class, stable code registry, cause-chain traversal, Zod-validated wire format (JSON + MessagePack), redaction, OTel span-event adapter, i18n resolver hook.
|
||||
---
|
||||
|
||||
# @suaveplan/error
|
||||
|
||||
Foundation error substrate for Suaveplan. Every non-testing `@suaveplan/*` package extends this library's `SuaveplanError` base class and uses its stable code registry. The package provides: `SuaveplanError<TCode>` — an abstract base with literal-typed discriminant codes, injectable clock, context bag, traceId, and cause chaining; `defineCodes(namespace, reasons)` — a frozen, literal-typed registry that makes error codes refactor-safe; `walkCauses(err)` — a cycle-safe, depth-bounded generator for traversing nested error causes; lossless JSON and binary wire formats (`toJSON`/`fromJSON`/`toBinary`/`fromBinary`) with Zod validation; `markSensitive`/`unwrapSensitive` for redaction at serialization boundaries; `toSpanEvent` for OpenTelemetry `exception` span events without an OTel SDK import; and a `setMessageResolver` hook for i18n. Zero `@suaveplan/*` runtime or peer dependencies — this is the lowest-level package in the stack.
|
||||
|
||||
## When to use this skill
|
||||
|
||||
- Implementing or debugging code that imports `@suaveplan/error`.
|
||||
- The task touches: see package README.
|
||||
- You need API guidance for this package's exports.
|
||||
|
||||
## Quick reference
|
||||
|
||||
```ts
|
||||
import { /* see API Reference below */ } from "@suaveplan/error";
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
Workspace dependencies: `@suaveplan/types`
|
||||
|
||||
## Where to read more
|
||||
|
||||
This skill is intentionally short. The package's own documentation is the authoritative source — read these in order:
|
||||
|
||||
1. **`packages/foundation/error/README.md`** — overview, install, quick-start, module index
|
||||
2. **`packages/foundation/error/src/**/*.md`** — co-located docs per implementation file (Purpose, Features, Basic + Advanced examples, full API reference, Implementation notes — all packages ship ≥200 words per module)
|
||||
3. **`packages/foundation/error/package.json`** `exports` map — every subpath you can import from
|
||||
|
||||
When the user asks an API question, read the relevant co-located `.md` first; do not answer from training-data memory.
|
||||
|
||||
## See also
|
||||
|
||||
- `@suaveplan/types`
|
||||
|
||||
---
|
||||
|
||||
_This SKILL.md is auto-generated by `suaveplan-skills/scripts/generate-skills.ts` from the package's README. Do not edit by hand — re-run the generator after the README changes._
|
||||
Reference in New Issue
Block a user