Registry Mirror
Skip to content

‎apps/content/docs/helpers/lock.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const result = await call(procedure, { id: '123' }, { context: { locker } })
108108
```
109109

110110
:::tip[Custom Error]
111-
Use `error` to throw your own error instead of `CONFLICT`. A custom code responds with `400` unless you map it in [`errorStatusMap`](/docs/rpc/handler#custom-error-response), and is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the procedure declares.
111+
Use `error` to throw your own error instead of `CONFLICT`. A custom code responds with `400` unless you map it in [`errorStatuses`](/docs/rpc/handler#custom-error-response), and is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the procedure declares.
112112

113113
```ts
114114
lock({

‎apps/content/docs/helpers/ratelimit.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ When the same `limiter` and `key` combination is used multiple times in a single
9494
:::
9595

9696
:::tip[Custom Error]
97-
By default the middleware throws `TOO_MANY_REQUESTS`. Use `error` to throw your own, which is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the procedure declares. A custom code responds with `400` unless you map it in [`errorStatusMap`](/docs/rpc/handler#custom-error-response).
97+
By default the middleware throws `TOO_MANY_REQUESTS`. Use `error` to throw your own, which is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the procedure declares. A custom code responds with `400` unless you map it in [`errorStatuses`](/docs/rpc/handler#custom-error-response).
9898

9999
```ts
100100
ratelimit({

‎apps/content/docs/migrations/from-v1.mdx‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ Because of these changes, a v1 [RPC Link](/docs/rpc/link) or [OpenAPI Link](/doc
5858
If your [OpenAPI Handler](/docs/openapi/handler) endpoints have external consumers that expect the v1 error format, add the `status` field back with a [custom error response](/docs/openapi/handler#custom-error-response):
5959

6060
```ts
61-
import { COMMON_ERROR_STATUS_MAP } from '@orpc/openapi'
61+
import { COMMON_ERROR_STATUSES } from '@orpc/openapi'
6262

6363
const handler = new OpenAPIHandler(router, {
6464
errorResponseBodyEncoder: (error) => ({
6565
...error.toJSON(),
66-
status: COMMON_ERROR_STATUS_MAP[error.code] ?? 400,
66+
status: COMMON_ERROR_STATUSES[error.code] ?? 400,
6767
}),
6868
})
6969
```
@@ -403,14 +403,14 @@ The `dedupeLeadingMiddlewares` config option was removed together with this beha
403403

404404
### `status` removed from errors
405405

406-
`ORPCError` and `.errors` definitions no longer accept a `status`. HTTP status codes are now a handler concern, configured with `errorStatusMap`. Error response bodies no longer contain the field either, see [Wire Format Changes](#wire-format-changes). See [Error Handling](/docs/error-handling) and [RPC Handler](/docs/rpc/handler).
406+
`ORPCError` and `.errors` definitions no longer accept a `status`. HTTP status codes are now a handler concern, configured with `errorStatuses`. Error response bodies no longer contain the field either, see [Wire Format Changes](#wire-format-changes). See [Error Handling](/docs/error-handling) and [RPC Handler](/docs/rpc/handler).
407407

408-
Codes missing from `errorStatusMap` now fall back to `400` instead of `500`. If a custom code reports a server-side failure, add it to the map with a `5xx` status.
408+
Codes missing from `errorStatuses` now fall back to `400` instead of `500`. If a custom code reports a server-side failure, add it with a `5xx` status.
409409

410410
<CodeGroup>
411411

412412
```ts v2
413-
import { COMMON_ERROR_STATUS_MAP } from '@orpc/server'
413+
import { COMMON_ERROR_STATUSES } from '@orpc/server'
414414

415415
const example = os
416416
.errors({
@@ -421,7 +421,7 @@ const example = os
421421
})
422422

423423
const handler = new RPCHandler(router, {
424-
errorStatusMap: { ...COMMON_ERROR_STATUS_MAP, RATE_LIMITED: 429 },
424+
errorStatuses: { ...COMMON_ERROR_STATUSES, RATE_LIMITED: 429 },
425425
})
426426
```
427427

‎apps/content/docs/openapi/handler.mdx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,17 @@ const handler = new OpenAPIHandler(router, {
183183

184184
## Custom Error Response
185185

186-
By default, `OpenAPIHandler` determines response status codes using `COMMON_ERROR_STATUS_MAP`, falling back to `400` for codes missing from the map, and encodes error bodies in the ORPC error format. Use `errorStatusMap` and `errorResponseBodyEncoder` to customize this behavior:
186+
By default, `OpenAPIHandler` determines response status codes using `COMMON_ERROR_STATUSES`, falling back to `400` for codes missing from it, and encodes error bodies in the ORPC error format. Use `errorStatuses` and `errorResponseBodyEncoder` to customize this behavior:
187187

188188
```ts
189-
import { COMMON_ERROR_STATUS_MAP } from '@orpc/openapi'
189+
import { COMMON_ERROR_STATUSES } from '@orpc/openapi'
190190

191191
const handler = new OpenAPIHandler(router, {
192192
/**
193193
* The status code should be in the `4xx` or `5xx` range (must be greater than or equal to `400`).
194194
*/
195-
errorStatusMap: {
196-
...COMMON_ERROR_STATUS_MAP,
195+
errorStatuses: {
196+
...COMMON_ERROR_STATUSES,
197197
CUSTOM_ERROR: 599,
198198
},
199199
errorResponseBodyEncoder: (error) => {
@@ -209,7 +209,7 @@ const handler = new OpenAPIHandler(router, {
209209
})
210210
```
211211

212-
<Expandable title="Common Error Status Map">
212+
<Expandable title="Common Error Statuses">
213213

214214
| Error Code | HTTP Status Code |
215215
| ---------------------- | ---------------: |

‎apps/content/docs/openapi/specification.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ const spec = await generator.generate(router, {
256256
If your [OpenAPI Handler](/docs/openapi/handler#custom-error-response) uses custom error response formats, configure `OpenAPIGenerator` with the same logic so the generated document matches the actual error response formats.
257257

258258
```ts
259-
import { COMMON_ERROR_STATUS_MAP } from '@orpc/openapi'
259+
import { COMMON_ERROR_STATUSES } from '@orpc/openapi'
260260

261261
const spec = await generator.generate(router, {
262-
errorStatusMap: {
263-
...COMMON_ERROR_STATUS_MAP,
262+
errorStatuses: {
263+
...COMMON_ERROR_STATUSES,
264264
PLANET_GONE: 410,
265265
},
266266
errorResponseBodySchema: (definedErrors, status, defaultSchema) => {

‎apps/content/docs/plugins/get-method-csrf-protection.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The `handler` can be any supported oRPC handler, such as [RPCHandler](/docs/rpc/
4545

4646
## Custom Error
4747

48-
By default the plugin throws `FORBIDDEN`. Use `error` to throw your own, which is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the matched procedure declares. A custom code responds with `400` unless you map it in [`errorStatusMap`](/docs/rpc/handler#custom-error-response).
48+
By default the plugin throws `FORBIDDEN`. Use `error` to throw your own, which is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the matched procedure declares. A custom code responds with `400` unless you map it in [`errorStatuses`](/docs/rpc/handler#custom-error-response).
4949

5050
```ts
5151
new GetMethodCsrfProtectionHandlerPlugin({

‎apps/content/docs/plugins/request-limit.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ When used with [Request Compression](/docs/plugins/request-compression), `maxBod
3434

3535
## Custom Error
3636

37-
By default the plugin throws `PAYLOAD_TOO_LARGE`. Use `error` to throw your own, which is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the matched procedure declares. A custom code responds with `400` unless you map it in [`errorStatusMap`](/docs/rpc/handler#custom-error-response).
37+
By default the plugin throws `PAYLOAD_TOO_LARGE`. Use `error` to throw your own, which is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the matched procedure declares. A custom code responds with `400` unless you map it in [`errorStatuses`](/docs/rpc/handler#custom-error-response).
3838

3939
```ts
4040
new RequestLimitHandlerPlugin({

‎apps/content/docs/plugins/tmp-file-upload.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ A multipart body splits across the first two limits, fields and part headers aga
112112

113113
The plugin subsumes the [Request Limit Plugin](/docs/plugins/request-limit). When the [Request Compression Plugin](/docs/plugins/request-compression) is present, limits apply to the decompressed payload rather than the compressed wire size.
114114

115-
To reject with your own error instead, use `error`. It is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the matched procedure declares. A custom code responds with `400` unless you map it in [`errorStatusMap`](/docs/rpc/handler#custom-error-response).
115+
To reject with your own error instead, use `error`. It is [defined](/docs/error-handling#orpcerror-compatibility) when its `code` and `data` match an error the matched procedure declares. A custom code responds with `400` unless you map it in [`errorStatuses`](/docs/rpc/handler#custom-error-response).
116116

117117
```ts
118118
new TmpFileUploadHandlerPlugin({

‎apps/content/docs/rpc/handler.mdx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,23 @@ const handler = new RPCHandler(router, {
253253

254254
## Custom Error Response
255255

256-
By default, `RPCHandler` uses `COMMON_ERROR_STATUS_MAP` to determine response status codes, and codes missing from the map fall back to `400`. Use `errorStatusMap` to customize them:
256+
By default, `RPCHandler` uses `COMMON_ERROR_STATUSES` to determine response status codes, and codes missing from it fall back to `400`. Use `errorStatuses` to customize them:
257257

258258
```ts
259-
import { COMMON_ERROR_STATUS_MAP } from '@orpc/server'
259+
import { COMMON_ERROR_STATUSES } from '@orpc/server'
260260

261261
const handler = new RPCHandler(router, {
262262
/**
263263
* The status code should be in the `4xx` or `5xx` range (must be greater than or equal to `400`).
264264
*/
265-
errorStatusMap: {
266-
...COMMON_ERROR_STATUS_MAP,
265+
errorStatuses: {
266+
...COMMON_ERROR_STATUSES,
267267
CUSTOM_ERROR: 599,
268268
},
269269
})
270270
```
271271

272-
<Expandable title="Common Error Status Map">
272+
<Expandable title="Common Error Statuses">
273273

274274
| Error Code | HTTP Status Code |
275275
| ---------------------- | ---------------: |

‎packages/client/src/error.test-d.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { COMMON_ERROR_STATUS_MAP, ORPCErrorCode } from './error'
1+
import type { COMMON_ERROR_STATUSES, ORPCErrorCode } from './error'
22
import { ORPCError } from './error'
33

44
describe('ORPCErrorCode', () => {
55
it('suggests common codes and accepts any string', () => {
66
// oRPC relies on any string being a valid code, see docs/error-handling
77
expectTypeOf<ORPCErrorCode>().toEqualTypeOf<
8-
keyof typeof COMMON_ERROR_STATUS_MAP | (string & {})
8+
keyof typeof COMMON_ERROR_STATUSES | (string & {})
99
>()
1010
})
1111
})

0 commit comments

Comments
 (0)