Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .changeset/error-code-field.md

This file was deleted.

7 changes: 7 additions & 0 deletions examples/community-adapter-skeleton/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# evlog-community-adapter-skeleton

## 2.0.0

### Patch Changes

- Updated dependencies [[`8080662`](https://github.com/HugoRCD/evlog/commit/8080662e0ba2b3746aebf0aa1c5cf89756c3c44d)]:
- evlog@2.16.0

## 1.0.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/community-adapter-skeleton/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evlog-community-adapter-skeleton",
"version": "1.0.0",
"version": "2.0.0",
"description": "Reference skeleton for a community evlog drain adapter built on defineHttpDrain.",
"private": true,
"type": "module",
Expand Down
7 changes: 7 additions & 0 deletions examples/community-enricher-skeleton/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# evlog-community-enricher-skeleton

## 2.0.0

### Patch Changes

- Updated dependencies [[`8080662`](https://github.com/HugoRCD/evlog/commit/8080662e0ba2b3746aebf0aa1c5cf89756c3c44d)]:
- evlog@2.16.0

## 1.0.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/community-enricher-skeleton/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evlog-community-enricher-skeleton",
"version": "1.0.0",
"version": "2.0.0",
"description": "Reference skeleton for a community evlog enricher built on defineEnricher.",
"private": true,
"type": "module",
Expand Down
7 changes: 7 additions & 0 deletions examples/community-framework-skeleton/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# evlog-community-framework-skeleton

## 2.0.0

### Patch Changes

- Updated dependencies [[`8080662`](https://github.com/HugoRCD/evlog/commit/8080662e0ba2b3746aebf0aa1c5cf89756c3c44d)]:
- evlog@2.16.0

## 1.0.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/community-framework-skeleton/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evlog-community-framework-skeleton",
"version": "1.0.0",
"version": "2.0.0",
"description": "Reference skeleton for a community evlog framework integration built on defineFrameworkIntegration.",
"private": true,
"type": "module",
Expand Down
30 changes: 30 additions & 0 deletions packages/evlog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# evlog

## 2.16.0

### Minor Changes

- [#318](https://github.com/HugoRCD/evlog/pull/318) [`8080662`](https://github.com/HugoRCD/evlog/commit/8080662e0ba2b3746aebf0aa1c5cf89756c3c44d) Thanks [@HugoRCD](https://github.com/HugoRCD)! - Add an optional `code` field to `createError` / `EvlogError` so structured errors can carry a stable, machine-readable identifier for client branching, dashboards, and future error-catalog tooling. Foundation for an upcoming `defineErrorCatalog` primitive.

```ts
import { createError, parseError } from "evlog";

throw createError({
code: "PAYMENT_DECLINED",
message: "Payment failed",
status: 402,
why: "Card declined by issuer",
fix: "Try a different payment method",
});

// Client
const err = parseError(caught);
if (err.code === "PAYMENT_DECLINED") retryWithDifferentCard();
```

`code` is public and propagates through every existing serialization path with no breaking change:
- **HTTP responses** — surfaces under `data.code` via the existing `EvlogError.data` getter (Nitro v2/v3, Next.js, and any framework using `serializeEvlogErrorResponse` get it for free).
- **`parseError(err)`** — new `code` field on `ParsedError`. Extracted from EvlogError JSON, h3-style `data.code`, and Node-style `Error.code` (e.g. `'ENOENT'`, `'ECONNRESET'`) so existing system errors flow through the same client branch.
- **Wide events** — copied onto `event.error.code` so drains and dashboards can group, alert, and chart by code without parsing free-text messages.
- **`toString()`** — renders a `Code:` line for terminal pretty-print.

Out of scope here (planned next): `defineErrorCatalog` for centralized typed code unions, plus the equivalent for audit actions.

## 2.15.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/evlog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evlog",
"version": "2.15.0",
"version": "2.16.0",
"description": "Modern TypeScript logger — simple logs, wide events, structured errors. Built for scripts, libraries, jobs, edge, and HTTP. One drain pipeline everywhere.",
"author": "HugoRCD <contact@hrcd.fr>",
"homepage": "https://evlog.dev",
Expand Down