# Message

> Represents error message templates.

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

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

Represents error message templates.

This enum defines formatted error messages for various error conditions that may occur during operations such as
value validation.

It provides message templates that can be formatted at call sites.

Each case represents a specific type of error, with a message template that can be populated with dynamic values
using the [`Message::getMessage()`](/docs/extensions/html-svg/reference/exception/message/index.md#method-getMessage) method.

Each message template can be formatted with arguments.

## Cases

| Case | Value | Description |
| --- | --- | --- |
| <span id="case-CONTENT_AND_FILEPATH_CANNOT_BE_BOTH_EMPTY"></span>`CONTENT_AND_FILEPATH_CANNOT_BE_BOTH_EMPTY` | `'File path and content cannot be empty at the same time for SVG.'` | Error when both content and file path are empty. |
| <span id="case-FAILED_TO_READ_FILE"></span>`FAILED_TO_READ_FILE` | `"Failed to read file: '%s'."` | Error when failed to read a file. |
| <span id="case-FAILED_TO_SANITIZE_SVG"></span>`FAILED_TO_SANITIZE_SVG` | `"Failed to sanitize SVG content from file: '%s'."` | Error when failed to sanitize SVG content from a file. |
| <span id="case-ICON_REFERENCE_FILE_NOT_FOUND"></span>`ICON_REFERENCE_FILE_NOT_FOUND` | `"Icon reference '%s' does not resolve to a bundled SVG file."` | Error when the icon reference resolves to a path that is not a bundled SVG file. |
| <span id="case-ICON_REFERENCE_MUST_BE_COLLECTION_NAME"></span>`ICON_REFERENCE_MUST_BE_COLLECTION_NAME` | `"Icon reference '%s' must be in the form 'Collection:name'."` | Error when the icon reference does not follow the `Collection:name` format. |
| <span id="case-TITLE_ATTRIBUTE_MUST_BE_STRING_OR_NULL"></span>`TITLE_ATTRIBUTE_MUST_BE_STRING_OR_NULL` | `"Title attribute must be a 'string' or 'null'."` | Error when the title attribute is not a `string` or `null`. |
| <span id="case-VALUE_MUST_BE_GTE_ONE_OR_NULL"></span>`VALUE_MUST_BE_GTE_ONE_OR_NULL` | `"Value must be a number greater than or equal to '1' or 'null' to unset."` | Error when the value is not a number `>= 1` or `null`. |
| <span id="case-VALUE_MUST_BE_POSITIVE_NUMBER_OR_NULL"></span>`VALUE_MUST_BE_POSITIVE_NUMBER_OR_NULL` | `"Value must be a positive number or 'null' to unset."` | Error when the value is not a positive number or `null`. |
| <span id="case-VALUE_OUT_OF_RANGE_OR_NULL"></span>`VALUE_OUT_OF_RANGE_OR_NULL` | `"Value must be a number between '%s' and '%s' inclusive or 'null' to unset."` | Error when the value is out of range or not `null`. |

## 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. Usage example: throw new InvalidArgumentException(Message::FAILED_TO_READ_FILE->getMessage($filePath));