> ## Documentation Index
> Fetch the complete documentation index at: https://eo.utopy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ORPCTaggedError

> Factory for yieldable Effect errors that convert to oRPC errors.

`ORPCTaggedError` creates Effect-native tagged error classes for oRPC procedures.

```ts title="import.ts" theme={null}
import { ORPCTaggedError } from "effect-orpc";
```

## Basic error

```ts title="basic.ts" theme={null}
class UserNotFoundError extends ORPCTaggedError("UserNotFoundError") {}
```

The default code is the tag converted to constant case: `USER_NOT_FOUND_ERROR`.

## Error with options

```ts title="with-options.ts" theme={null}
class ValidationError extends ORPCTaggedError("ValidationError", {
  code: "BAD_REQUEST",
  status: 400,
  message: "Validation failed",
}) {}
```

## Error with typed data

```ts title="with-data.ts" theme={null}
class UserNotFoundError extends ORPCTaggedError("UserNotFoundError", {
  code: "NOT_FOUND",
  status: 404,
  schema: z.object({ id: z.string() }),
}) {}

return yield * new UserNotFoundError({ data: { id: "1" } });
```

## Helpers

| Export                                 | Purpose                                           |
| -------------------------------------- | ------------------------------------------------- |
| `isORPCTaggedError(value)`             | Check an error instance.                          |
| `isORPCTaggedErrorClass(value)`        | Check an error class.                             |
| `toORPCError(error)`                   | Convert to an `ORPCError`.                        |
| `effectErrorMapToErrorMap(map)`        | Convert an Effect error map to an oRPC error map. |
| `createEffectErrorConstructorMap(map)` | Build constructors for handler `errors`.          |

## See also

* [Typed errors](/effect-v4/capabilities/typed-errors)
