# Message

> Represents error message templates for library exceptions.

[API reference](/docs/api/index.md) › [HTML Core](/docs/extensions/html-core/reference/index.md) › [Exception](/docs/extensions/html-core/reference/exception/index.md) › Message

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

Represents error message templates for library exceptions.

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

## Cases

| Case | Value | Description |
| --- | --- | --- |
| <span id="case-CANNOT_INSTANTIATE_ABSTRACT_CLASS"></span>`CANNOT_INSTANTIATE_ABSTRACT_CLASS` | `"Cannot instantiate abstract class '%s' via 'tag()' method."` | Error when attempting to instantiate an abstract class. |
| <span id="case-COMPONENT_METADATA_KEYS_MUST_BE_NON_EMPTY_STRINGS"></span>`COMPONENT_METADATA_KEYS_MUST_BE_NON_EMPTY_STRINGS` | `'Component metadata keys must be non-empty strings.'` | Error when a component metadata key is not a non-empty string. |
| <span id="case-COMPONENT_STATES_MUST_BE_STRING_LIST"></span>`COMPONENT_STATES_MUST_BE_STRING_LIST` | `'Component states must be a list of non-empty strings.'` | Error when component states are not a list of non-empty strings. |
| <span id="case-CONFIG_ARGUMENTS_MUST_BE_POSITIONAL_LIST"></span>`CONFIG_ARGUMENTS_MUST_BE_POSITIONAL_LIST` | `'Config arguments must be an ordered positional list.'` | Error when config call arguments are passed by name instead of position. |
| <span id="case-CONFIG_CALL_EXECUTION_FAILED"></span>`CONFIG_CALL_EXECUTION_FAILED` | `"Config call '%s' from recipe '%s' failed for component '%s' (%s): %s"` | Error when a config call fails during execution. |
| <span id="case-CONFIG_CALL_METHOD_NOT_AVAILABLE"></span>`CONFIG_CALL_METHOD_NOT_AVAILABLE` | `"Config call '%s' from recipe '%s' is not a public instance method for " . "component '%s' (%s)."` | Error when a config call does not target a public instance method. |
| <span id="case-CONFIG_CALL_RETURNED_INCOMPATIBLE_VALUE"></span>`CONFIG_CALL_RETURNED_INCOMPATIBLE_VALUE` | `"Config call '%s' from recipe '%s' must return component '%s' " . '(%s); %s returned.'` | Error when a config call returns an incompatible value. |
| <span id="case-CONFIG_DOES_NOT_DEFINE_COMPONENT_FACTORY"></span>`CONFIG_DOES_NOT_DEFINE_COMPONENT_FACTORY` | `'Config does not define a component factory.'` | Error when creating a component without a configured component factory. |
| <span id="case-CONFIG_KEY_MUST_BE_STRING"></span>`CONFIG_KEY_MUST_BE_STRING` | `'Config key "%s::%s" must be a string naming a method or property.'` | Error when a config key is numeric instead of a method or property name. |
| <span id="case-CONFIG_KEY_MUST_MATCH_METHOD_OR_PROPERTY"></span>`CONFIG_KEY_MUST_MATCH_METHOD_OR_PROPERTY` | `'Config key "%s::%s" must match a method or property.'` | Error when a config key matches neither a method nor a property of the configured tag. |
| <span id="case-CONFIG_METHOD_MUST_BE_NON_EMPTY"></span>`CONFIG_METHOD_MUST_BE_NON_EMPTY` | `'Config method must be a non-empty string without whitespace.'` | Error when a config method name is empty or contains whitespace. |
| <span id="case-CONFIG_METHOD_MUST_BE_PUBLIC"></span>`CONFIG_METHOD_MUST_BE_PUBLIC` | `'Config method "%s::%s()" must be a public instance method.'` | Error when a config key targets a method that is not a public instance method. |
| <span id="case-CONFIG_METHOD_MUST_RETURN_TAG"></span>`CONFIG_METHOD_MUST_RETURN_TAG` | `'Config method "%s::%s()" must return an instance of the tag class; %s ' . 'returned.'` | Error when a config method returns a value that is not an instance of the configured tag class. |
| <span id="case-CONFIG_PROPERTY_MUST_BE_PUBLIC"></span>`CONFIG_PROPERTY_MUST_BE_PUBLIC` | `'Config property "%s::$%s" must be a public instance property.'` | Error when a config targets a property that is not a public instance property. |
| <span id="case-CONFIG_PROPERTY_MUST_BE_WRITABLE"></span>`CONFIG_PROPERTY_MUST_BE_WRITABLE` | `'Config property "%s::$%s" must be publicly writable.'` | Error when a config targets a property that rejects the write, such as `readonly` or asymmetric visibility. |
| <span id="case-CONFIG_RETURNED_INCOMPATIBLE_COMPONENT"></span>`CONFIG_RETURNED_INCOMPATIBLE_COMPONENT` | `"Config for component '%s' (%s) returned incompatible component %s."` | Error when a config applier returns a component incompatible with the fluent receiver. |
| <span id="case-COOKBOOK_CALLS_MUST_BE_POSITIONAL_LIST"></span>`COOKBOOK_CALLS_MUST_BE_POSITIONAL_LIST` | `'Cookbook calls must be an ordered positional list.'` | Error when cookbook calls are passed by name instead of position. |
| <span id="case-EVENT_KEY_MUST_START_WITH_ON"></span>`EVENT_KEY_MUST_START_WITH_ON` | `'Event key "%s" must start with "on".'` | Error when an event key does not start with 'on'. |
| <span id="case-TAG_CLASS_MISMATCH_ON_END"></span>`TAG_CLASS_MISMATCH_ON_END` | `"Mismatched '%s::end()' call, got '%s'."` | Error when there is a class mismatch on `end()` call. |
| <span id="case-TAG_DOES_NOT_SUPPORT_BEGIN"></span>`TAG_DOES_NOT_SUPPORT_BEGIN` | `"Tag '%s' does not support 'begin()' method."` | Error when a tag does not support `begin()` method. |
| <span id="case-UNEXPECTED_END_CALL_NO_BEGIN"></span>`UNEXPECTED_END_CALL_NO_BEGIN` | `"Unexpected '%s::end()' call, a matching 'begin()' is not found."` | Error when an unexpected `end()` call is made without a matching `begin()`. |
| <span id="case-VALUE_MUST_BE_NON_EMPTY_WITHOUT_WHITESPACE"></span>`VALUE_MUST_BE_NON_EMPTY_WITHOUT_WHITESPACE` | `'%s must be non-empty and contain no whitespace.'` | Error when a named value is empty or contains whitespace. |
| <span id="case-VALUE_MUST_BE_STRING_OR_STRING_BACKED_ENUM"></span>`VALUE_MUST_BE_STRING_OR_STRING_BACKED_ENUM` | `'%s must be a string or a string-backed enum; int-backed enum ' . "'%s' given."` | Error when a named value is passed as an int-backed enum instead of a string or a string-backed enum. |

## 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.