# ErrorException

> ErrorException represents a PHP error.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [base](/docs/api/yii/base/index.md) › ErrorException

| class | `yii\base\ErrorException` |
| --- | --- |
| Extends | [`ErrorException`](https://www.php.net/manual/en/class.errorexception.php) |
| Since | 2.0 |
| Source | [`framework/base/ErrorException.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/base/ErrorException.php#L21) |

ErrorException represents a PHP error.

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

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Constructs the exception. | `ErrorException` |
| [`getName()`](#method-getName) |  | `ErrorException` |
| [`isFatalError()`](#method-isFatalError) static | Returns if error is one of fatal type. | `ErrorException` |

## Method details

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

```php
public function __construct(string $message = '', int $code = 0, int $severity = 1, string $filename = __FILE__, int $lineno = __LINE__, Throwable|null $previous = null)
```

Constructs the exception.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$message` | `string` | [optional] |
| `$code` | `int` | [optional] |
| `$severity` | `int` | [optional] |
| `$filename` | `string` | [optional] |
| `$lineno` | `int` | [optional] |
| `$previous` | [`Throwable`](https://www.php.net/manual/en/class.throwable.php)`\|null` | [optional] |

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

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

**Returns**

`string`: The user-friendly name of this exception

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

```php
public static function isFatalError(array $error): bool
```

Returns if error is one of fatal type.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$error` | `array` | Error got from error_get_last() |

**Returns**

`bool`: If error is one of fatal type