# NotInstantiableException

> NotInstantiableException represents an exception caused by incorrect dependency injection container configuration or usage.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [di](/docs/api/yii/di/index.md) › NotInstantiableException

| class | `yii\di\NotInstantiableException` |
| --- | --- |
| Extends | [`yii\base\InvalidConfigException`](/docs/api/yii/base/invalidconfigexception/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.9 |
| Source | [`framework/di/NotInstantiableException.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/di/NotInstantiableException.php#L20) |

NotInstantiableException represents an exception caused by incorrect dependency injection container
configuration or usage.

## Methods

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

## Method details

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

```php
public function __construct(mixed $class, mixed $message = null, mixed $code = 0, mixed $previous = null)
```

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$class` | `mixed` |  |
| `$message` | `mixed` |  |
| `$code` | `mixed` |  |
| `$previous` | `mixed` |  |

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

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

**Returns**

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