> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# UserDataError

> Class exported by @botmesh/core.

Defined in: [user/errors.ts:41](https://github.com/andresayac/botmesh/blob/main/packages/core/src/user/errors.ts#L41)

Error thrown (or rejected) by every `ctx.user` / `bot.user()` operation on
invalid input or when user data is not available. Inspect `code` rather than
the message.

## Example

```ts theme={null}
try { await ctx.user.set('a..b', 1) }
catch (error) {
  if (error instanceof UserDataError && error.code === 'INVALID_PATH') { ... }
}
```

## Extends

* `Error`

## Constructors

### Constructor

```ts theme={null}
new UserDataError(
   code, 
   message, 
   options?
): UserDataError;
```

Defined in: [user/errors.ts:42](https://github.com/andresayac/botmesh/blob/main/packages/core/src/user/errors.ts#L42)

#### Parameters

| Parameter | Type |
| - | - |
| `code` | [`UserDataErrorCode`](https://botmesh.afaya.com.co/api/core/type-aliases/UserDataErrorCode) |
| `message` | `string` |
| `options?` | \{ `cause?`: `unknown`; } |
| `options.cause?` | `unknown` |

#### Returns

`UserDataError`

#### Overrides

`Error.constructor`

## Properties

### code

```ts theme={null}
readonly code: UserDataErrorCode;
```

Defined in: [user/errors.ts:43](https://github.com/andresayac/botmesh/blob/main/packages/core/src/user/errors.ts#L43)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.