<!-- This file is auto-generated by the docs:generate-viewhelper-docs command. Do not edit directly -->

# ui:error

**Reference:** [View Source](https://github.com/jramke/fluid-primitives/tree/main/Classes/ViewHelpers/ErrorViewHelper.php)

Throws an exception with your own message when a condition is true.

Use it in a component for a misconfiguration that argument definitions cannot express, such as missing slot content:

```html
<f:variable name="reviewText" value="{f:slot() -> f:format.trim()}" />
<ui:error when="!{reviewText}" message="ui:productReview needs the review text as slot content." />
```

## Arguments

| Name | Type | Description | Required | Default |
|------|------|-------------|----------|--------|
| `when` | bool | The condition that triggers the exception | Yes | - |
| `message` | string | The exception message | No | 'An error occurred in Fluid.' |
| `code` | int | The exception code | No | 1759132287 |
