LMDBException constructor

LMDBException(
  1. String message,
  2. int errorCode
)

Creates a new LMDB exception with the given message and error code.

The errorString is automatically populated by calling the native LMDB mdb_strerror function.

Example:

throw LMDBException('Failed to open database', -30781);

Implementation

LMDBException(this.message, this.errorCode) {
  // Lazy access to native library through singleton
  final ptr = LMDBNative.instance.lib.mdb_strerror(errorCode);
  errorString = ptr.cast<Utf8>().toDartString();
}