handleErrorMessage method

void handleErrorMessage(
  1. Pointer<Pointer<Char>> errorMessage, [
  2. int? status
])
inherited

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');
    }
  }
}