Software /
code /
prosody
Changeset
10031:17c175ad65f9
mod_storage_sql: Correctly return item-not-found error
`return ok, err` comes out as `transaction_ok, ok, err`
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 28 May 2019 00:46:24 +0200 |
parents | 10030:98ef41a60fc3 |
children | 10032:de5ab807e438 |
files | plugins/mod_storage_sql.lua |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua Mon May 27 19:17:12 2019 +0200 +++ b/plugins/mod_storage_sql.lua Tue May 28 00:46:24 2019 +0200 @@ -367,7 +367,7 @@ if total ~= nil and query.limit == 0 and query.start == nil and query.with == nil and query["end"] == nil and query.key == nil then return noop, total; end - local ok, result = engine:transaction(function() + local ok, result, err = engine:transaction(function() local sql_query = [[ SELECT "key", "type", "value", "when", "with" FROM "prosodyarchive" @@ -407,7 +407,8 @@ and "DESC" or "ASC", query.limit and " LIMIT ?" or ""); return engine:select(sql_query, unpack(args)); end); - if not ok then return ok, result end + if not ok then return ok, result; end + if not result then return nil, err; end return function() local row = result(); if row ~= nil then