checkLastError function

void checkLastError()

Implementation

void checkLastError() {
  final lib = NativeLibrary();
  final code = lib.htmLastErrorCode();
  if (code != 0) {
    final contextPtr = lib.htmLastErrorContext();
    final message = contextPtr.toDartString();
    switch (code) {
      case 1:
        throw InvalidInputException(message, errorCode: code);
      case 2:
        throw ConversionErrorException(message, errorCode: code);
      default:
        throw HtmlToMarkdownException(message, errorCode: code);
    }
  }
}