diff options
author | ubq323 <ubq323@ubq323.website> | 2023-06-18 03:30:14 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2023-06-18 03:30:14 +0100 |
commit | d5e264125994b6e5943ffb42f607362b3e79bcba (patch) | |
tree | aadd33ac3337fb026acb93b83ca89099a09d6a1c /server | |
parent | ed2f984d046d6c148c07661c94febdbe2aa37f7f (diff) |
improve error handling in db.lua
Diffstat (limited to 'server')
-rw-r--r-- | server/db.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/db.lua b/server/db.lua index a4cd8a7..4a6e6d3 100644 --- a/server/db.lua +++ b/server/db.lua @@ -1,14 +1,14 @@ local lmdb = require'lmdb' -local env = lmdb.open('data',{maxdbs=16}) +local env = assert(lmdb.open('data',{maxdbs=16})) local function get_db(dbname, writeable) -- shortcut if writeable == nil then writeable = false end - local txn = assert(env:txn_begin(writeable),"couldn't begin txn") - local the_db = assert(txn:open(dbname), "couldn't open db") + local txn = assert(env:txn_begin(writeable)) + local the_db = assert(txn:open(dbname)) return txn,the_db end local function txn(writeable) - return assert(env:txn_begin(writeable), "couldn't begin txn") + return assert(env:txn_begin(writeable)) end |