mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
util.sql: Log errors in transaction to error level with traceback but return only error message (fixes #464)
This commit is contained in:
parent
41522cb84a
commit
c24be27b2f
1 changed files with 5 additions and 1 deletions
|
@ -202,6 +202,10 @@ function engine:debug(enable)
|
|||
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 @@ function engine:_transaction(func, ...)
|
|||
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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue