> For the complete documentation index, see [llms.txt](https://docs.macilib.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.macilib.org/docs/maci/errors.md).

# errors

All exceptions/errors thrown from the maci library, including 3rd-party libraries, are redirected and handled with a maci-specific naming convention and helpful output.

The helpful output aims to try and provide useful and easy-to-understand information to quickly gather the reason for the exception thrown. This helpful output effort will consistently be improved or reiterated, and therefore an example will not be given.

### path name convention

The exception path name convention contains 3-parts and ensures simplicity in locating the exception.\
\
Here is the convention and how to break it down:

*Example exception name:*  maci.error.ExceptionName

* `maci` is the top-level module name.
* `error` is a submodule of `maci`, which contains definitions of various error or exception classes related to the `maci` module.
* `ExceptionName` is the class name of the specific exception being raised.

### handling exception thrown

Any time an exception is thrown, maci will provide the true module path followed by the class name of the exception to keep it simple, so there is no need to import anything additional to handle it.\
\
\&#xNAN;*Example of maci exception thrown by* [*load*](/docs/maci/functions/maci.load.md) *showing the full module and class path for bad filepath*

```bash
maci.error.Load: [Errno 2] No such file or directory: 'test.data'
```

If needing to handle this, you would simply write or copy the exception path, and that will handle that specific exception.

*Example handling above exception*

```python
try:
    ...
except maci.error.Load:
    ...
```

### maci base exception

All maci exceptions derive from its base exception **MaciError**. To handle all exceptions thrown from the maci library, you can handle the following exception path:

```python
maci.error.MaciError
```
