Software /
code /
prosody
Changeset
7317:a2dce746599b
util.sql: Log errors in transaction to error level with traceback but return only error message (fixes #464)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 25 Mar 2016 16:09:34 +0100 |
parents | 7315:4fd984d1e445 |
children | 7318:1fa6052f3a07 7319:afa83f3ccaad |
files | util/sql.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/sql.lua Wed Mar 23 23:21:03 2016 +0100 +++ b/util/sql.lua Fri Mar 25 16:09:34 2016 +0100 @@ -202,6 +202,10 @@ engine.update = engine.execute_update; end end +local function handleerr(err) + log("error", "Error in SQL transaction: %s", debug_traceback(err, 3)); + return err; +end function engine:_transaction(func, ...) if not self.conn then local ok, err = self:connect(); @@ -212,7 +216,7 @@ local function f() return func(unpack(args, 1, n_args)); end log("debug", "SQL transaction begin [%s]", tostring(func)); self.__transaction = true; - local success, a, b, c = xpcall(f, debug_traceback); + local success, a, b, c = xpcall(f, handleerr); self.__transaction = nil; if success then log("debug", "SQL transaction success [%s]", tostring(func));