﻿<head><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4357510538660394"
     crossorigin="anonymous"></script></head>---
title: 'Rethrow Handler Plugin'
description: "Bypass oRPC's built-in error handling and rethrow matching errors to your framework, such as NestJS filters or Express error middleware."
sidebar:
  label: 'Rethrow'
---

## Usage

```ts
import { RethrowHandlerPlugin } from '@orpc/server/plugins'

const handler = new RPCHandler(router, {
  plugins: [
    new RethrowHandlerPlugin({
      filter: (error, options) => {
        // Example: Rethrow all non-ORPCError errors
        return !(error instanceof ORPCError)
      },
    }),
  ],
})

try {
  await handler.handle(request)
} catch (error) {
  // If the filter returns true, the error can be caught her