Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# Error handling

When an error occurs within the SDK, a DocumentException exception is thrown. Generally you should wrap all invocations of the API into a try-catch block.

Python

    try:
        # ...
    except DocumentException as ex:
        print(f"Document SDK exception: {ex}")

Dart

    try
    {
       // ...
    }
    on DocumentException catch (e) {
        print('Document SDK exception: $e');
    }

C#

    try
    {
       // ...
    }
    catch (DocumentException ex)
    {
        Console.WriteLine(ex.Message);
    }

Java

    try {
        // ...
    }
    catch (DocumentException ex) {
    }

Swift

    do {
        // ...
    } catch let error as DocumentException {
        print(error.message)
    }

C

In C and C++ languages, you have to handle the errors manually. The possible error codes are listed in the DocumentError, ImageError and LicenseError enumerations.

An example is given below:

    int err = id3DocumentLibrary_CheckLicense(path, nullptr);
    if (err != id3DocumentError_Success) {
      // handle error here.
    }

## See also

- DocumentException Exception

- DocumentError Enumeration

- ImageError Enumeration

- LicenseError Enumeration