# ErrorHandler

> ErrorHandler handles uncaught PHP errors and exceptions.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [web](/docs/api/yii/web/index.md) › ErrorHandler

| class | `yii\web\ErrorHandler` |
| --- | --- |
| Extends | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) » [`yii\base\Component`](/docs/api/yii/base/component/index.md) » [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| Implements | [`yii\base\Configurable`](/docs/api/yii/base/configurable/index.md) |
| Since | 2.0 |
| Source | [`framework/web/ErrorHandler.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/web/ErrorHandler.php#L35) |

1 subclass:

- [`yii2\extensions\psrbridge\http\ErrorHandler`](/docs/extensions/psr-bridge/reference/http/errorhandler/index.md)

ErrorHandler handles uncaught PHP errors and exceptions.

ErrorHandler displays these errors using appropriate views based on the
nature of the errors and the mode the application runs at.

ErrorHandler is configured as an application component in [`Application`](/docs/api/yii/base/application/index.md) by default.
You can access that instance via `Yii::$app->errorHandler`.

For more details and usage information on ErrorHandler, see the [guide article on handling errors](/docs/guide/runtime-handling-errors/index.md).

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-behaviors"></span>[`$behaviors`](/docs/api/yii/base/component/index.md#property-behaviors) read-only | `array<`[`yii\base\Behavior`](/docs/api/yii/base/behavior/index.md)`<static>>` | List of behaviors attached to this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="property-callStackItemView"></span>`$callStackItemView` | `string` | The path of the view file for rendering exceptions and errors call stack element. Default: `'@yii/views/errorHandler/callStackItem.php'`. | `ErrorHandler` |
| <span id="property-discardExistingOutput"></span>[`$discardExistingOutput`](/docs/api/yii/base/errorhandler/index.md#property-discardExistingOutput) | `bool` | Whether to discard any existing page output before error display. Default: `true`. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| [`$displayVars`](#property-displayVars) | `array` | List of the PHP predefined variables that should be displayed on the error page. Default: `['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION']`. Available since 2.0.7. | `ErrorHandler` |
| [`$errorAction`](#property-errorAction) | `string\|null` | The route (e.g. `site/error`) to the controller action that will be used to display external errors. Default: `null`. | `ErrorHandler` |
| <span id="property-errorView"></span>`$errorView` | `string` | The path of the view file for rendering exceptions without call stack information. Default: `'@yii/views/errorHandler/error.php'`. | `ErrorHandler` |
| <span id="property-exception"></span>[`$exception`](/docs/api/yii/base/errorhandler/index.md#property-exception) | [`Throwable`](https://www.php.net/manual/en/class.throwable.php)`\|null` | The exception that is being handled currently. Default: `null`. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| <span id="property-exceptionView"></span>`$exceptionView` | `string` | The path of the view file for rendering exceptions. Default: `'@yii/views/errorHandler/exception.php'`. | `ErrorHandler` |
| [`$maxSourceLines`](#property-maxSourceLines) | `int` | Maximum number of source code lines to be displayed. Default: `19`. | `ErrorHandler` |
| [`$maxTraceSourceLines`](#property-maxTraceSourceLines) | `int` | Maximum number of trace source code lines to be displayed. Default: `13`. | `ErrorHandler` |
| <span id="property-memoryReserveSize"></span>[`$memoryReserveSize`](/docs/api/yii/base/errorhandler/index.md#property-memoryReserveSize) | `int` | The size of the reserved memory. Default: `262144`. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| <span id="property-previousExceptionView"></span>`$previousExceptionView` | `string` | The path of the view file for rendering previous exceptions. Default: `'@yii/views/errorHandler/previousException.php'`. | `ErrorHandler` |
| <span id="property-silentExitOnException"></span>[`$silentExitOnException`](/docs/api/yii/base/errorhandler/index.md#property-silentExitOnException) | `bool` | If true - `handleException()` will finish script with `ExitCode::OK`. false - `ExitCode::UNSPECIFIED_ERROR`. Default: `null`. Available since 2.0.36. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| [`$traceLine`](#property-traceLine) | `string` | Trace line with placeholders to be be substituted. Default: `'{html}'`. Available since 2.0.14. | `ErrorHandler` |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-__construct"></span>[`__construct()`](/docs/api/yii/base/baseobject/index.md#method-__construct) | Constructor. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__call"></span>[`__call()`](/docs/api/yii/base/component/index.md#method-__call) | Calls the named method which is not a class method. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__clone"></span>[`__clone()`](/docs/api/yii/base/component/index.md#method-__clone) | This method is called after the object is created by cloning an existing one. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__get"></span>[`__get()`](/docs/api/yii/base/component/index.md#method-__get) | Returns the value of a component property. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__isset"></span>[`__isset()`](/docs/api/yii/base/component/index.md#method-__isset) | Checks if a property is set, i.e. defined and not null. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__set"></span>[`__set()`](/docs/api/yii/base/component/index.md#method-__set) | Sets the value of a component property. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-__unset"></span>[`__unset()`](/docs/api/yii/base/component/index.md#method-__unset) | Sets a component property to be null. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| [`addTypeLinks()`](#method-addTypeLinks) | Adds informational links to the given PHP type/class. | `ErrorHandler` |
| [`argumentsToString()`](#method-argumentsToString) | Converts arguments array to its string representation. | `ErrorHandler` |
| <span id="method-attachBehavior"></span>[`attachBehavior()`](/docs/api/yii/base/component/index.md#method-attachBehavior) | Attaches a behavior to this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-attachBehaviors"></span>[`attachBehaviors()`](/docs/api/yii/base/component/index.md#method-attachBehaviors) | Attaches a list of behaviors to the component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-behaviors"></span>[`behaviors()`](/docs/api/yii/base/component/index.md#method-behaviors) | Returns a list of behaviors that this component should behave as. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-canGetProperty"></span>[`canGetProperty()`](/docs/api/yii/base/component/index.md#method-canGetProperty) | Returns a value indicating whether a property can be read. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-canSetProperty"></span>[`canSetProperty()`](/docs/api/yii/base/component/index.md#method-canSetProperty) | Returns a value indicating whether a property can be set. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-className"></span>[`className()`](/docs/api/yii/base/baseobject/index.md#method-className) static | Returns the fully qualified name of this class. | [`yii\base\BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-clearOutput"></span>[`clearOutput()`](/docs/api/yii/base/errorhandler/index.md#method-clearOutput) | Removes all output echoed before calling this method. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| <span id="method-convertExceptionToString"></span>[`convertExceptionToString()`](/docs/api/yii/base/errorhandler/index.md#method-convertExceptionToString) static | Converts an exception into a simple string. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| <span id="method-convertExceptionToVerboseString"></span>[`convertExceptionToVerboseString()`](/docs/api/yii/base/errorhandler/index.md#method-convertExceptionToVerboseString) static | Converts an exception into a string that has verbose information about the exception and its trace. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| [`createFrameworkVersionLink()`](#method-createFrameworkVersionLink) | Creates string containing HTML link which refers to the page with the current version of the framework and version number text. | `ErrorHandler` |
| [`createHttpStatusLink()`](#method-createHttpStatusLink) | Creates HTML containing link to the page with the information on given HTTP status code. | `ErrorHandler` |
| [`createServerInformationLink()`](#method-createServerInformationLink) | Creates string containing HTML link which refers to the home page of determined web-server software and its full name. | `ErrorHandler` |
| <span id="method-detachBehavior"></span>[`detachBehavior()`](/docs/api/yii/base/component/index.md#method-detachBehavior) | Detaches a behavior from the component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-detachBehaviors"></span>[`detachBehaviors()`](/docs/api/yii/base/component/index.md#method-detachBehaviors) | Detaches all behaviors from the component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-ensureBehaviors"></span>[`ensureBehaviors()`](/docs/api/yii/base/component/index.md#method-ensureBehaviors) | Makes sure that the behaviors declared in [`behaviors()`](/docs/api/yii/base/component/index.md#method-behaviors) are attached to this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-getBehavior"></span>[`getBehavior()`](/docs/api/yii/base/component/index.md#method-getBehavior) | Returns the named behavior object. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-getBehaviors"></span>[`getBehaviors()`](/docs/api/yii/base/component/index.md#method-getBehaviors) | Returns all behaviors attached to this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| [`getExceptionName()`](#method-getExceptionName) | Returns human-readable exception name. | `ErrorHandler` |
| <span id="method-handleError"></span>[`handleError()`](/docs/api/yii/base/errorhandler/index.md#method-handleError) | Handles PHP execution errors such as warnings and notices. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| <span id="method-handleException"></span>[`handleException()`](/docs/api/yii/base/errorhandler/index.md#method-handleException) | Handles uncaught PHP exceptions. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| <span id="method-handleFatalError"></span>[`handleFatalError()`](/docs/api/yii/base/errorhandler/index.md#method-handleFatalError) | Handles fatal PHP errors. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| <span id="method-hasEventHandlers"></span>[`hasEventHandlers()`](/docs/api/yii/base/component/index.md#method-hasEventHandlers) | Returns a value indicating whether there is any handler attached to the named event. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-hasMethod"></span>[`hasMethod()`](/docs/api/yii/base/component/index.md#method-hasMethod) | Returns a value indicating whether a method is defined. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-hasProperty"></span>[`hasProperty()`](/docs/api/yii/base/component/index.md#method-hasProperty) | Returns a value indicating whether a property is defined for this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| [`htmlEncode()`](#method-htmlEncode) | Converts special characters to HTML entities. | `ErrorHandler` |
| <span id="method-init"></span>[`init()`](/docs/api/yii/base/errorhandler/index.md#method-init) |  | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| [`isCoreFile()`](#method-isCoreFile) | Determines whether given name of the file belongs to the framework. | `ErrorHandler` |
| <span id="method-logException"></span>[`logException()`](/docs/api/yii/base/errorhandler/index.md#method-logException) | Logs the given exception. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| <span id="method-off"></span>[`off()`](/docs/api/yii/base/component/index.md#method-off) | Detaches an existing event handler from this component. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-on"></span>[`on()`](/docs/api/yii/base/component/index.md#method-on) | Attaches an event handler to an event. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-register"></span>[`register()`](/docs/api/yii/base/errorhandler/index.md#method-register) | Register this error handler. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| [`renderCallStack()`](#method-renderCallStack) | Renders call stack. | `ErrorHandler` |
| [`renderCallStackItem()`](#method-renderCallStackItem) | Renders a single call stack element. | `ErrorHandler` |
| [`renderFile()`](#method-renderFile) | Renders a view file as a PHP script. | `ErrorHandler` |
| [`renderPreviousExceptions()`](#method-renderPreviousExceptions) | Renders the previous exception stack for a given Exception. | `ErrorHandler` |
| [`renderRequest()`](#method-renderRequest) | Renders the global variables of the request. | `ErrorHandler` |
| <span id="method-trigger"></span>[`trigger()`](/docs/api/yii/base/component/index.md#method-trigger) | Triggers an event. | [`yii\base\Component`](/docs/api/yii/base/component/index.md) |
| <span id="method-unregister"></span>[`unregister()`](/docs/api/yii/base/errorhandler/index.md#method-unregister) | Unregisters this error handler by restoring the PHP error and exception handlers. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| [`convertExceptionToArray()`](#method-convertExceptionToArray) protected | Converts an exception into an array. | `ErrorHandler` |
| [`getTypeUrl()`](#method-getTypeUrl) protected | Returns the informational link URL for a given PHP type/class. | `ErrorHandler` |
| <span id="method-handleFallbackExceptionMessage"></span>[`handleFallbackExceptionMessage()`](/docs/api/yii/base/errorhandler/index.md#method-handleFallbackExceptionMessage) protected | Handles exception thrown during exception processing in [`handleException()`](/docs/api/yii/base/errorhandler/index.md#method-handleException). | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |
| [`renderException()`](#method-renderException) protected | Renders the exception. | `ErrorHandler` |
| [`shouldRenderSimpleHtml()`](#method-shouldRenderSimpleHtml) protected |  | `ErrorHandler` |
| [`triggerAfterRender()`](#method-triggerAfterRender) protected | Triggers [`EVENT_AFTER_RENDER`](/docs/api/yii/web/errorhandler/index.md#const-EVENT_AFTER_RENDER) and returns final HTML content. | `ErrorHandler` |

## Events

| Event | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="event-EVENT_SHUTDOWN"></span>[`EVENT_SHUTDOWN`](/docs/api/yii/base/errorhandler/index.md#event-EVENT_SHUTDOWN) | [`yii\base\Event`](/docs/api/yii/base/event/index.md) | An event that is triggered when the handler is called by shutdown function via [`handleFatalError()`](/docs/api/yii/base/errorhandler/index.md#method-handleFatalError). Event name: `'shutdown'`. Available since 2.0.46. | [`yii\base\ErrorHandler`](/docs/api/yii/base/errorhandler/index.md) |

## Constants

| Constant | Value | Description | Defined by |
| --- | --- | --- | --- |
| <span id="const-EVENT_AFTER_RENDER"></span>`EVENT_AFTER_RENDER` | `'afterRender'` | [`ErrorHandlerRenderEvent`](/docs/api/yii/web/errorhandlerrenderevent/index.md) an event that is triggered after HTML error content is rendered. Available since 22.0. | `ErrorHandler` |

## Property details

### $displayVars <span id="property-displayVars"></span>

```php
public array $displayVars = ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION']
```

List of the PHP predefined variables that should be displayed on the error page.

Note that a variable must be accessible via `$GLOBALS`. Otherwise it won't be displayed.
Defaults to `['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION']`.

**Since**

2.0.7

### $errorAction <span id="property-errorAction"></span>

```php
public string|null $errorAction = null
```

The route (e.g. `site/error`) to the controller action that will be used to display external errors.

Inside the action, it can retrieve the error information
using `Yii::$app->errorHandler->exception`. This property defaults to null, meaning ErrorHandler
will handle the error display.

### $maxSourceLines <span id="property-maxSourceLines"></span>

```php
public int $maxSourceLines = 19
```

Maximum number of source code lines to be displayed.

Defaults to 19.

### $maxTraceSourceLines <span id="property-maxTraceSourceLines"></span>

```php
public int $maxTraceSourceLines = 13
```

Maximum number of trace source code lines to be displayed.

Defaults to 13.

### $traceLine <span id="property-traceLine"></span>

```php
public string $traceLine = '{html}'
```

Trace line with placeholders to be be substituted.

The placeholders are {file}, {line} and {text} and the string should be as follows.

`File: {file} - Line: {line} - Text: {text}`

**Since**

2.0.14

## Method details

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

```php
public function addTypeLinks(string $code): string
```

Adds informational links to the given PHP type/class.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$code` | `string` | Type/class name to be linkified. |

**Returns**

`string`: Linkified with HTML type/class name.

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

```php
public function argumentsToString(array $args): string
```

Converts arguments array to its string representation.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$args` | `array` | Arguments array to be converted |

**Returns**

`string`: String representation of the arguments array

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

```php
public function createFrameworkVersionLink(): string
```

Creates string containing HTML link which refers to the page with the current version
of the framework and version number text.

**Returns**

`string`: Framework version information hyperlink.

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

```php
public function createHttpStatusLink(int $statusCode, string $statusDescription): string
```

Creates HTML containing link to the page with the information on given HTTP status code.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$statusCode` | `int` | To be used to generate information link. |
| `$statusDescription` | `string` | Description to display after the the status code. |

**Returns**

`string`: Generated HTML with HTTP status code information.

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

```php
public function createServerInformationLink(): string
```

Creates string containing HTML link which refers to the home page of determined web-server software
and its full name.

**Returns**

`string`: Server software information hyperlink.

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

```php
public function getExceptionName(Throwable $exception): string|null
```

Returns human-readable exception name.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$exception` | [`Throwable`](https://www.php.net/manual/en/class.throwable.php) |  |

**Returns**

`string|null`: Human-readable exception name or null if it cannot be determined

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

```php
public function htmlEncode(string $text): string
```

Converts special characters to HTML entities.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$text` | `string` | To encode. |

**Returns**

`string`: Encoded original text.

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

```php
public function isCoreFile(string $file): bool
```

Determines whether given name of the file belongs to the framework.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$file` | `string` | Name to be checked. |

**Returns**

`bool`: Whether given name of the file belongs to the framework.

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

```php
public function renderCallStack(Throwable $exception): string
```

Renders call stack.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$exception` | [`Throwable`](https://www.php.net/manual/en/class.throwable.php) | Exception to get call stack from |

**Returns**

`string`: HTML content of the rendered call stack.

**Since**

2.0.12

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

```php
public function renderCallStackItem(string|null $file, int|null $line, string|null $class, string|null $method, array $args, int $index): string
```

Renders a single call stack element.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$file` | `string\|null` | Name where call has happened. |
| `$line` | `int\|null` | Number on which call has happened. |
| `$class` | `string\|null` | Called class name. |
| `$method` | `string\|null` | Called function/method name. |
| `$args` | `array` | Array of method arguments. |
| `$index` | `int` | Number of the call stack element. |

**Returns**

`string`: HTML content of the rendered call stack element.

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

```php
public function renderFile(string $_file_, array $_params_): string
```

Renders a view file as a PHP script.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$_file_` | `string` | The view file. |
| `$_params_` | `array` | The parameters (name-value pairs) that will be extracted and made available in the view file. |

**Returns**

`string`: The rendering result

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

```php
public function renderPreviousExceptions(Throwable $exception): string
```

Renders the previous exception stack for a given Exception.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$exception` | [`Throwable`](https://www.php.net/manual/en/class.throwable.php) | The exception whose precursors should be rendered. |

**Returns**

`string`: HTML content of the rendered previous exceptions. Empty string if there are none.

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

```php
public function renderRequest(): string
```

Renders the global variables of the request.

List of global variables is defined in [`$displayVars`](/docs/api/yii/web/errorhandler/index.md#property-displayVars).

**Returns**

`string`: The rendering result

**See also**

- [`$displayVars`](/docs/api/yii/web/errorhandler/index.md#property-displayVars)

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

```php
protected function convertExceptionToArray(Throwable $exception): array
```

Converts an exception into an array.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$exception` | [`Throwable`](https://www.php.net/manual/en/class.throwable.php) | The exception being converted |

**Returns**

`array`: The array representation of the exception.

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

```php
protected function getTypeUrl(string $class, string|null $method): string|null
```

Returns the informational link URL for a given PHP type/class.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$class` | `string` | The type or class name. |
| `$method` | `string\|null` | The method name. |

**Returns**

`string|null`: The informational link URL.

**See also**

- [`addTypeLinks()`](/docs/api/yii/web/errorhandler/index.md#method-addTypeLinks)

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

```php
protected function renderException(Throwable $exception): mixed
```

Renders the exception.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$exception` | [`Throwable`](https://www.php.net/manual/en/class.throwable.php) | The exception to be rendered. |

**Returns**

`mixed`

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

```php
protected function shouldRenderSimpleHtml(): bool
```

**Returns**

`bool`: If simple HTML should be rendered

**Since**

2.0.12

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

```php
protected function triggerAfterRender(Throwable $exception, string $output): string
```

Triggers [`EVENT_AFTER_RENDER`](/docs/api/yii/web/errorhandler/index.md#const-EVENT_AFTER_RENDER) and returns final HTML content.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$exception` | [`Throwable`](https://www.php.net/manual/en/class.throwable.php) | The exception being rendered. |
| `$output` | `string` | The rendered HTML output. |

**Returns**

`string`: The final HTML output.

**Since**

22.0