Changeset

6738:845bc5ba306d

mod_storage_sql2: Improve logging when database read fails
author Matthew Wild <mwild1@gmail.com>
date Wed, 24 Jun 2015 22:56:50 +0100
parents 6737:9f932a31eeba
children 6739:6216743c188c
files plugins/mod_storage_sql2.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_sql2.lua	Wed Jun 24 22:55:41 2015 +0100
+++ b/plugins/mod_storage_sql2.lua	Wed Jun 24 22:56:50 2015 +0100
@@ -199,8 +199,11 @@
 function keyval_store:get(username)
 	user, store = username, self.store;
 	local ok, result = engine:transaction(keyval_store_get);
-	if not ok then return ok, result; end
-	return result;
+	if not ok then
+		module:log("error", "Unable to read from database %s store for %s: %s", store, username or "<host>", result);
+		return nil, result;
+	end
+	return result;	
 end
 function keyval_store:set(username, data)
 	user,store = username,self.store;