code: func convertErr(desc string, ldbErr error) database.Error {
  	// Use the driver-specific error code by default.  The code below will
  	// update this with the converted error if it's recognized.
  	var code = database.ErrDriverSpecific
  
  	switch {
  	// Database corruption errors.
  	case ldberrors.IsCorrupted(ldbErr):
  		code = database.ErrCorruption
  
  	// Database open/create errors.
  	case ldbErr == leveldb.ErrClosed:
  		code = database.ErrDbNotOpen
  
  	// Transaction errors.
  	case ldbErr == leveldb.ErrSnapshotReleased:
  		code = database.ErrTxClosed
  	case ldbErr == leveldb.ErrIterReleased:
  		code = database.ErrTxClosed
  	}
  
  	return database.Error{ErrorCode: code, Description: desc, Err: ldbErr}
  }
docs: // convertErr converts the passed leveldb error into a database error with an
  // equivalent error code  and the passed description.  It also sets the passed
  // error as the underlying error.