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.

try:
    # ...
except DocumentException as ex:
    print(f"Document SDK exception: {ex}")
try
{
   // ...
}
on DocumentException catch (e) {
    print('Document SDK exception: $e');
}
try
{
   // ...
}
catch (DocumentException ex)
{
    Console.WriteLine(ex.Message);
}
try {
    // ...
}
catch (DocumentException ex) {
}
do {
    // ...
} catch let error as DocumentException {
    print(error.message)
}

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