oRPC Rethrow Handler Plugin
Catch and rethrow specific errors during request handling.
Файлы2
Открыть в GitHubSKILL.mdskills/orpc-rethrow-handler/SKILL.md
GitHubRethrow Handler Plugin
The RethrowHandlerPlugin lets you catch and rethrow specific errors during request handling. Useful when your framework has its own error handling mechanism (e.g., global exception filters in NestJS, error middleware in Express).
Usage
import { ORPCError } from '@orpc/server'
import { RPCHandler } from '@orpc/server/fetch'
import {
experimental_RethrowHandlerPlugin as RethrowHandlerPlugin,
} from '@orpc/server/plugins'
const handler = new RPCHandler(router, {
plugins: [
new RethrowHandlerPlugin({
filter: (error) => {
// Rethrow all non-ORPCError errors
return !(error instanceof ORPCError)
},
}),
],
})
The
handlercan be any supported oRPC handler.