Skip to content

Commit

Permalink
Throw errors in all cursor put/del functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Martchus committed Jan 22, 2022
1 parent f35efb5 commit 74d7bbd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lmdb-safe.hh
Original file line number Diff line number Diff line change
Expand Up @@ -630,17 +630,18 @@ public:
}


int put(const MDBOutVal& key, const MDBOutVal& data, unsigned int flags=0)
void put(const MDBOutVal& key, const MDBOutVal& data, unsigned int flags=0)
{
// XXX check errors
return mdb_cursor_put(*this,
if (const auto rc = mdb_cursor_put(*this,
const_cast<MDB_val*>(&key.d_mdbval),
const_cast<MDB_val*>(&data.d_mdbval), flags);
const_cast<MDB_val*>(&data.d_mdbval), flags))
throw LMDBError("Putting data via mdb_cursor_put: ", rc);
}

int del(unsigned int flags=0)
void del(unsigned int flags=0)
{
return mdb_cursor_del(*this, flags);
if (const auto rc = mdb_cursor_del(*this, flags))
throw LMDBError("Deleting data via mdb_cursor_del: ", rc);
}

};
Expand Down

0 comments on commit 74d7bbd

Please sign in to comment.