Error Handling¶
When an error occurs within the SDK, a FaceException exception is thrown. Generally you should wrap all invocations of the API into a try-catch block.
try:
# ...
except id3face.FaceException as ex:
print(f"SDK exception: {ex}")
try
{
// ...
}
on FaceException catch (e) {
print('Face SDK exception: $e');
}
try
{
// ...
}
catch (FaceException ex)
{
Console.WriteLine(ex.Message);
}
try {
// ...
}
catch (FaceException ex) {
}
do {
// ...
} catch let error as FaceException {
print(error.message)
}
In C and C++ languages, you have to handle the errors manually. The possible error codes are listed in the FaceError, ImageError and LicenseError enumerations.
An example is given below:
int err = id3FaceLicense_CheckLicense(path, nullptr);
if (err != id3FaceError_Success) {
// handle error here.
}