@web-ts-toolkit/http-errors 0.43.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -59,12 +59,11 @@ void [aip193, rfc9457, validation];
|
|
|
59
59
|
|
|
60
60
|
## Main Exports
|
|
61
61
|
|
|
62
|
-
- `HttpError`
|
|
63
|
-
- `
|
|
64
|
-
-
|
|
65
|
-
- `
|
|
66
|
-
- `
|
|
67
|
-
- `toRfc9457ValidationErrorPayload(...)`
|
|
62
|
+
- `HttpError`, `ClientError`, and `ServerError` base classes
|
|
63
|
+
- 38 specific error classes: 27 client (`4xx`) and 11 server (`5xx`) errors (see `src/client-errors.ts` and `src/server-errors.ts`)
|
|
64
|
+
- serializers: `toAip193ErrorPayload(...)` (with `fallbackDomain='http-errors'` default), `toRfc9457ErrorPayload(...)`, `toRfc9457ValidationErrorPayload(...)`, and `createAip193ErrorInfoDetail(...)`
|
|
65
|
+
- status helpers (see `src/status.ts`): `canonicalStatusByHttpStatus`, `getCanonicalStatus`, `getStatusTitle`, `isHttpErrorStatusCode`, `validateHttpErrorStatusCode`, `validateClientErrorStatusCode`, `validateServerErrorStatusCode`
|
|
66
|
+
- message helpers (see `src/messages.ts`): `messages`, `getDefaultMessage`
|
|
68
67
|
- types including `HttpErrorOptions`, `HttpErrorShape`, `HttpErrorProblemFields`, `HttpErrorMetadataValue`, `Aip193ErrorInfoDetail`, `Aip193ErrorPayload`, `Rfc9457ErrorPayload`, and `Rfc9457ValidationError`
|
|
69
68
|
|
|
70
69
|
## AIP-193 Serializer Contract
|
|
@@ -91,7 +90,7 @@ void payload;
|
|
|
91
90
|
|
|
92
91
|
`toRfc9457ErrorPayload(...)` emits required RFC 9457 problem members (`type`, `title`, `status`, and `detail`) on every payload. If the input shape has `errors` typed as an array, the returned payload preserves that entry type for custom extension errors.
|
|
93
92
|
|
|
94
|
-
When `type` is missing it falls back to `about:blank`. When `title` is missing it falls back to the canonical HTTP status title, or `Unknown` for unmapped status codes. `instance` is emitted only when present.
|
|
93
|
+
When `type` is missing it falls back to `about:blank`. When `title` is missing it falls back to the canonical HTTP status title, or `Unknown Error` for unmapped status codes. `instance` is emitted only when present.
|
|
95
94
|
|
|
96
95
|
```ts
|
|
97
96
|
import { BadRequestError, toRfc9457ErrorPayload } from '@web-ts-toolkit/http-errors';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@web-ts-toolkit/http-errors",
|
|
3
3
|
"description": "Typed HTTP error classes and payload helpers for backend APIs",
|
|
4
4
|
"homepage": "https://web-ts-toolkit.pages.dev/docs/packages/http-errors",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.45.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"keywords": [
|
|
8
8
|
"http-errors",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"node": ">=22"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@web-ts-toolkit/utils": "0.
|
|
33
|
+
"@web-ts-toolkit/utils": "0.45.0"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"**/*",
|