Software /
code /
prosody
Comparison
plugins/mod_storage_sql2.lua @ 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 |
parent | 6737:9f932a31eeba |
child | 6739:6216743c188c |
comparison
equal
deleted
inserted
replaced
6737:9f932a31eeba | 6738:845bc5ba306d |
---|---|
197 local keyval_store = {}; | 197 local keyval_store = {}; |
198 keyval_store.__index = keyval_store; | 198 keyval_store.__index = keyval_store; |
199 function keyval_store:get(username) | 199 function keyval_store:get(username) |
200 user, store = username, self.store; | 200 user, store = username, self.store; |
201 local ok, result = engine:transaction(keyval_store_get); | 201 local ok, result = engine:transaction(keyval_store_get); |
202 if not ok then return ok, result; end | 202 if not ok then |
203 return result; | 203 module:log("error", "Unable to read from database %s store for %s: %s", store, username or "<host>", result); |
204 return nil, result; | |
205 end | |
206 return result; | |
204 end | 207 end |
205 function keyval_store:set(username, data) | 208 function keyval_store:set(username, data) |
206 user,store = username,self.store; | 209 user,store = username,self.store; |
207 return engine:transaction(function() | 210 return engine:transaction(function() |
208 return keyval_store_set(data); | 211 return keyval_store_set(data); |