# `@lazarv/react-server/error-boundary`

Error boundary primitives for server components: catch rendering errors, render fallbacks, and surface error info to your observability stack.

## Types

### `ErrorBoundaryComponentProps`

```ts
type ErrorBoundaryComponentProps = React.PropsWithChildren<{
    error: Error & {
        digest?: string;
    };
    resetErrorBoundary: () => void;
}>;
```

### `ErrorBoundaryProps`

```ts
type ErrorBoundaryProps = ErrorBoundaryPropsWithFallback | ErrorBoundaryPropsWithComponent | ErrorBoundaryPropsWithRender;
```

### `ErrorBoundaryPropsWithComponent`

```ts
type ErrorBoundaryPropsWithComponent = ErrorBoundarySharedProps & {
    fallback?: never;
    FallbackComponent: ComponentType<FallbackProps>;
    fallbackRender?: never;
};
```

### `ErrorBoundaryPropsWithFallback`

```ts
type ErrorBoundaryPropsWithFallback = ErrorBoundarySharedProps & {
    fallback: ReactElement<unknown, string | FunctionComponent | typeof Component> | null;
    FallbackComponent?: never;
    fallbackRender?: never;
};
```

### `ErrorBoundaryPropsWithRender`

```ts
type ErrorBoundaryPropsWithRender = ErrorBoundarySharedProps & {
    fallback?: never;
    FallbackComponent?: never;
    fallbackRender: typeof FallbackRender;
};
```

### `FallbackProps`

```ts
type FallbackProps = {
    error: any;
    resetErrorBoundary: (...args: any[]) => void;
};
```

### `ReactServerErrorBoundaryProps`

```ts
type ReactServerErrorBoundaryProps = React.PropsWithChildren<Omit<ErrorBoundaryProps, "fallback"> & {
    fallback?: React.ReactNode;
    component?: React.ComponentType<ErrorBoundaryComponentProps> | React.ReactNode;
}>;
```
