# Error Class

> Base class of the exceptions the public API raises for a library failure.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.5.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/Error
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/llms.txt

```cpp
class Error : runtime_error
```

**Namespace:** `datalogics_interface`

**Inherits from:** `runtime_error`

**Derived classes:** [`InternalError`](https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/InternalError.md), [`InvalidArgumentError`](https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/InvalidArgumentError.md), [`NotSupportedError`](https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/NotSupportedError.md), [`OfficeConvertError`](https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/OfficeConvertError.md), [`OperationCancelledException`](https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/OperationCancelledException.md), [`PDFError`](https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/PDFError.md), [`PageRangeError`](https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/PageRangeError.md), [`PermissionError`](https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/PermissionError.md), [`WebConvertError`](https://docs.datalogics.com/apdfl21/ModernCPP/21.5.0/class/WebConvertError.md)

## Description

Base class of the exceptions the public API raises for a library failure.

Catch this type to handle any of them. Catch one of the derived types to handle a single kind. `std::bad_alloc` and the other standard exceptions stay outside this hierarchy, so a handler for this type does not hide them.

## Constructors

### Error

```cpp
datalogics_interface::Error::Error(const std::string &message)
```

*constructor*

**Parameters**

- `message` (`const std::string &`)

## Methods

### get_error_code

```cpp
DL_ERROR_MEMBER int datalogics_interface::Error::get_error_code() const noexcept
```

**Returns:** `DL_ERROR_MEMBER int`

The Adobe PDF Library error code, or 0 when the failure carries none.

Decode the value with the APDFL `ErrGetSeverity`, `ErrGetSystem` and `ErrGetCode` macros, or compare it against a whole code.
