# IrtError: reason property

> The reason read-only property of the IrtError interface is the reason the router or the room gave, or an empty string.

The **`reason`** read-only property of the [`IrtError`](/docs/client/irt-error) interface is the reason the router or the room gave for the error, or `""` when there's none.

## Value

A string. It's one of:

- the close reason the router or the room gave, such as the reason room code passed to [`room.kick()`](/docs/room/room/kick) or [`room.ban()`](/docs/room/room/ban)
- for a call the room failed, the message of the error its handler threw, such as a [`CallRejected`](/docs/room/call-rejected)'s, or why the call's args were refused
- for an aborted connect or call, the `signal`'s reason as a string
- `""` when there's none

## Description

`reason` is written for players, so a game can show it: a kick's reason, or a game rule a call handler refused a move for. [`message`](/docs/client/irt-error/message) also contains it, after a description of the error that's written for developers.

## Examples

### Showing why a move was refused

The room refuses a move out of turn with `CallRejected`. The client shows the room's reason to the player.

```ts
// move.ts
import { call, connect, defineCalls, defineSchema, IrtError } from "@irtio/client";

const schema = defineSchema({ calls: defineCalls({ move: call({ cell: "u8" }) }) });
const room = await connect("tic-tac-toe", { schema });
const status = document.querySelector("#status")!;

export async function move(cell: number) {
  try {
    await room.calls.move({ cell });
  } catch (e) {
    if (e instanceof IrtError && e.name === "OperationError") status.textContent = e.reason;
    else throw e;
  }
}
```

## See also

- [`IrtError.message`](/docs/client/irt-error/message)
- [`CallRejected`](/docs/room/call-rejected), for refusing a call in the room
- [Calls](/docs/client/errors#calls), for each call error's reason
