# exceptions

Python API: `modelconverter.utils.exceptions`

Exception types raised by ModelConverter.

Everything the converter itself considers a failure of the conversion derives from
[ModelconverterException](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/exceptions.md#exceptions-Classes-ModelconverterException),
which the CLI catches to exit with status 1, as opposed to the status 2 it uses for an unexpected error. The module also holds
[exit_with](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/exceptions.md#exceptions-Functions-exit_with),
the helper used where an error is fatal enough to end the process on the spot.

## Classes

| Name | Description |
| --- | --- |
| [`ModelconverterException`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/exceptions.md#exceptions-Classes-ModelconverterException) | Base class of the exceptions raised by ModelConverter. |
| [`ONNXException`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/exceptions.md#exceptions-Classes-ONNXException) | Raised when an ONNX model cannot be inspected or modified. |
| [`PreprocessingEmbeddingError`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/exceptions.md#exceptions-Classes-PreprocessingEmbeddingError) | Raised when valid preprocessing cannot be embedded into a model. |
| [`S3Exception`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/exceptions.md#exceptions-Classes-S3Exception) | Raised when an operation on S3 storage fails. |

### exception `ModelconverterException`

```python
class ModelconverterException(BaseException)
```

Base class of the exceptions raised by ModelConverter.

### exception `ONNXException`

```python
class ONNXException(ModelconverterException)
```

Raised when an ONNX model cannot be inspected or modified.

### exception `PreprocessingEmbeddingError`

```python
class PreprocessingEmbeddingError(ModelconverterException)
```

Raised when valid preprocessing cannot be embedded into a model.

### exception `S3Exception`

```python
class S3Exception(ModelconverterException)
```

Raised when an operation on S3 storage fails.

## Functions

| Name | Description |
| --- | --- |
| [`exit_with`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/exceptions.md#exceptions-Functions-exit_with) | Log the exception and terminate the process. |

### function `exit_with`

```python
def exit_with(exception: BaseException, code: int = 1) -> NoReturn
```

Log the exception and terminate the process.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `exception` | `BaseException` | The exception to log, together with its traceback. | required |
| `code` | `int` | The exit status to terminate the process with. | `1` |

Returns

| Type | Description |
| --- | --- |
| `NoReturn` |  |
