changeset 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
parents 9276473ee5be
children 1d96629f5dda
files mod_log_messages_sql/mod_log_messages_sql.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
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