# Message

> Represents reusable error message templates for model exceptions.

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

| enum | `UIAwesome\Model\Exception\Message` |
| --- | --- |
| Backed by | `string` |
| Source | [`src/Exception/Message.php`](https://github.com/ui-awesome/model/blob/main/src/Exception/Message.php#L14) |

Represents reusable error message templates for model exceptions.

Use [`Message::getMessage()`](/docs/extensions/model/reference/exception/message/index.md#method-getMessage) to format template values via `sprintf()` placeholders.

## Cases

| Case | Value | Description |
| --- | --- | --- |
| <span id="case-CAST_SEPARATOR_EMPTY"></span>`CAST_SEPARATOR_EMPTY` | `'Cast separator cannot be empty.'` | Indicates an empty Cast separator. |
| <span id="case-CAST_TARGET_EMPTY"></span>`CAST_TARGET_EMPTY` | `'Cast target cannot be empty.'` | Indicates an empty Cast target. |
| <span id="case-COLLECTOR_MODEL_CLASS_MISMATCH"></span>`COLLECTOR_MODEL_CLASS_MISMATCH` | `"Cannot rebind collector for '%s' to model of class '%s'."` | Indicates an attempt to reuse collector metadata with a different model class. |
| <span id="case-DUPLICATE_MAP_FROM_KEY"></span>`DUPLICATE_MAP_FROM_KEY` | `"Duplicate MapFrom key '%s' in '%s::%s' and '%s::%s'."` | Indicates duplicate input-key mapping across model properties. |
| <span id="case-INVALID_CAST_CLASS"></span>`INVALID_CAST_CLASS` | `"Cast target '%s' for '%s::%s' must implement '%s'."` | Indicates cast class does not implement required caster contract. |
| <span id="case-INVALID_CAST_TARGET"></span>`INVALID_CAST_TARGET` | `"Invalid Cast target '%s' for '%s::%s'."` | Indicates unsupported cast target for a model property. |
| <span id="case-INVALID_DATE_TIME_STRING"></span>`INVALID_DATE_TIME_STRING` | `"Invalid date/time string '%s' for type '%s'."` | Indicates invalid string input for date/time object casting. |
| <span id="case-MAP_FROM_KEY_EMPTY"></span>`MAP_FROM_KEY_EMPTY` | `'MapFrom key cannot be empty.'` | Indicates an empty MapFrom input key. |
| <span id="case-READONLY_PROPERTY_ALREADY_INITIALIZED"></span>`READONLY_PROPERTY_ALREADY_INITIALIZED` | `"Cannot overwrite initialized readonly property: '%s::%s'."` | Indicates attempts to overwrite an initialized readonly property. |
| <span id="case-UNDEFINED_PROPERTY"></span>`UNDEFINED_PROPERTY` | `"Undefined property: '%s'."` | Indicates an undefined property without model class context. |
| <span id="case-UNDEFINED_PROPERTY_WITH_CLASS"></span>`UNDEFINED_PROPERTY_WITH_CLASS` | `"Undefined property: '%s::%s'."` | Indicates an undefined property including model class context. |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`getMessage()`](#method-getMessage) | Returns the formatted message string for the error case. | `Message` |

## Method details

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

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

Returns the formatted message string for the error case.

**Parameters**

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

**Returns**

`string`: Formatted error message with interpolated arguments.