# Message

> Defines exception message templates authored by the Yii2 Inertia adapter.

[API reference](/docs/api/index.md) › [Inertia](/docs/extensions/inertia/reference/index.md) › [Exception](/docs/extensions/inertia/reference/exception/index.md) › Message

| enum | `yii\inertia\Exception\Message` |
| --- | --- |
| Backed by | `string` |
| Source | [`src/Exception/Message.php`](https://github.com/yii2-extensions/inertia/blob/main/src/Exception/Message.php#L14) |

Defines exception message templates authored by the Yii2 Inertia adapter.

Use [`Message::getMessage()`](/docs/extensions/inertia/reference/exception/message/index.md#method-getMessage) to format a template with `sprintf()` arguments.

## Cases

| Case | Value | Description |
| --- | --- | --- |
| <span id="case-APPLICATION_COMPONENT_INVALID"></span>`APPLICATION_COMPONENT_INVALID` | `'The "inertia" application component must be an instance of %s.'` | The configured Inertia application component is invalid. |
| <span id="case-ERROR_FLASH_INVALID"></span>`ERROR_FLASH_INVALID` | `'The Inertia error flash must be an array.'` | The validation-error flash is not an array. |
| <span id="case-ERROR_KEY_INVALID"></span>`ERROR_KEY_INVALID` | `'Inertia error keys must be strings.'` | A validation-error key is not a string. |
| <span id="case-ERROR_MESSAGE_LIST_INVALID"></span>`ERROR_MESSAGE_LIST_INVALID` | `'Inertia error message lists must contain only strings.'` | A validation-error message list contains a non-string value. |
| <span id="case-ERROR_VALUE_INVALID"></span>`ERROR_VALUE_INVALID` | `'Inertia errors must contain strings or lists of strings.'` | A validation-error value has an unsupported structure. |
| <span id="case-SESSION_FLASH_KEY_INVALID"></span>`SESSION_FLASH_KEY_INVALID` | `'Inertia session flash keys must be strings.'` | A session flash key is not a string. |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`getMessage()`](#method-getMessage) | Formats the message template with the supplied arguments. | `Message` |

## Method details

### getMessage() <span id="method-getMessage"></span>

```php
public function getMessage(int|string ...$argument): string
```

Formats the message template with the supplied arguments.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `...$argument` | `int\|string` | Values inserted into the template. |

**Returns**

`string`: Formatted exception message.