handleErrorMessage method
Throws an exception if errorMessage
is non-empty.
Implementation
void handleErrorMessage(Pointer<Pointer<Char>> errorMessage, [int? status]) {
if (errorMessage.isNotNullPointer && errorMessage[0].isNotNullPointer) {
final dartErrorMessage = errorMessage.toDartStrings(1);
_log.severe('$taskName Error: $dartErrorMessage');
// If there is an exception, release this memory because the calling code
// will not get a chance to.
errorMessage.free(1);
// Raise the exception.
if (status == null) {
throw Exception('$taskName Error: $dartErrorMessage');
} else {
throw Exception('$taskName Error: Status $status :: $dartErrorMessage');
}
}
}