throwError method
Checks the error code and throws an exception if it indicates failure.
funcName is the function name to include in the error message.
code is the return value from the native API.
Implementation
void throwError(String funcName, int code) {
if (code != ailia_voice_dart.AILIA_STATUS_SUCCESS) {
ffi.Pointer<Utf8> p =
ailiaVoice.ailiaVoiceGetErrorDetail(ppAilia!.value).cast<Utf8>();
String errorDetail = p.toDartString();
throw Exception("$funcName failed $code \n detail $errorDetail");
}
}