Software /
code /
prosody-modules
Diff
mod_log_messages_sql/mod_log_messages_sql.lua @ 1639:398c4aaccf6d
mod_log_messages_sql: Better logging on error
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 31 Mar 2015 12:45:58 +0100 |
parent | 1343:7dbde05b48a9 |
child | 2407:be08b65f2855 |
line wrap: on
line diff
--- a/mod_log_messages_sql/mod_log_messages_sql.lua Tue Mar 31 12:44:28 2015 +0100 +++ b/mod_log_messages_sql/mod_log_messages_sql.lua Tue Mar 31 12:45:58 2015 +0100 @@ -98,7 +98,11 @@ return ...; end function sql.commit(...) - if not connection:commit() then return nil, "SQL commit failed"; end + local ok, err = connection:commit(); + if not ok then + module:log("error", "SQL commit failed: %s", tostring(err)); + return nil, "SQL commit failed: "..tostring(err); + end return ...; end