You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: apps/content/docs/helpers/ratelimit.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ When the same `limiter` and `key` combination is used multiple times in a single
94
94
:::
95
95
96
96
:::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).
Copy file name to clipboardExpand all lines: apps/content/docs/migrations/from-v1.mdx
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,12 +58,12 @@ Because of these changes, a v1 [RPC Link](/docs/rpc/link) or [OpenAPI Link](/doc
58
58
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):
@@ -403,14 +403,14 @@ The `dedupeLeadingMiddlewares` config option was removed together with this beha
403
403
404
404
### `status` removed from errors
405
405
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).
407
407
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.
Copy file name to clipboardExpand all lines: apps/content/docs/openapi/handler.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -183,17 +183,17 @@ const handler = new OpenAPIHandler(router, {
183
183
184
184
## Custom Error Response
185
185
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:
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.
Copy file name to clipboardExpand all lines: apps/content/docs/plugins/get-method-csrf-protection.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ The `handler` can be any supported oRPC handler, such as [RPCHandler](/docs/rpc/
45
45
46
46
## Custom Error
47
47
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).
Copy file name to clipboardExpand all lines: apps/content/docs/plugins/request-limit.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ When used with [Request Compression](/docs/plugins/request-compression), `maxBod
34
34
35
35
## Custom Error
36
36
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).
Copy file name to clipboardExpand all lines: apps/content/docs/plugins/tmp-file-upload.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,7 +112,7 @@ A multipart body splits across the first two limits, fields and part headers aga
112
112
113
113
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.
114
114
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).
Copy file name to clipboardExpand all lines: apps/content/docs/rpc/handler.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -253,23 +253,23 @@ const handler = new RPCHandler(router, {
253
253
254
254
## Custom Error Response
255
255
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:
0 commit comments