# Exception

> Exception represents an exception caused by incorrect usage of a console command.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [console](/docs/api/yii/console/index.md) › Exception

| class | `yii\console\Exception` |
| --- | --- |
| Extends | [`yii\base\UserException`](/docs/api/yii/base/userexception/index.md) » [`yii\base\Exception`](/docs/api/yii/base/exception/index.md) » [`Exception`](https://www.php.net/manual/en/class.exception.php) |
| Since | 2.0 |
| Source | [`framework/console/Exception.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/console/Exception.php#L19) |

1 subclass:

- [`UnknownCommandException`](/docs/api/yii/console/unknowncommandexception/index.md)

Exception represents an exception caused by incorrect usage of a console command.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`getName()`](#method-getName) |  | `Exception` |

## Method details

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

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

**Returns**

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