Software /
code /
prosody
Changeset
7305:c02e3d8f23fc
mod_storage_sql: Make sure all serialization errors are propagated
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 21 Mar 2016 09:33:12 +0100 |
parents | 7303:439d00063620 |
children | 7306:98c4c3a2b536 |
files | plugins/mod_storage_sql.lua |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua Sat Mar 19 16:35:43 2016 +0100 +++ b/plugins/mod_storage_sql.lua Mon Mar 21 09:33:12 2016 +0100 @@ -82,16 +82,14 @@ local extradata = {}; for key, value in pairs(data) do if type(key) == "string" and key ~= "" then - local t, value = serialize(value); - assert(t, value); + local t, value = assert(serialize(value)); engine:insert("INSERT INTO `prosody` (`host`,`user`,`store`,`key`,`type`,`value`) VALUES (?,?,?,?,?,?)", host, user or "", store, key, t, value); else extradata[key] = value; end end if next(extradata) ~= nil then - local t, extradata = serialize(extradata); - assert(t, extradata); + local t, extradata = assert(serialize(extradata)); engine:insert("INSERT INTO `prosody` (`host`,`user`,`store`,`key`,`type`,`value`) VALUES (?,?,?,?,?,?)", host, user or "", store, "", t, extradata); end end @@ -197,7 +195,7 @@ else key = uuid.generate(); end - local t, value = serialize(value); + local t, value = assert(serialize(value)); engine:insert("INSERT INTO `prosodyarchive` (`host`, `user`, `store`, `when`, `with`, `key`, `type`, `value`) VALUES (?,?,?,?,?,?,?,?)", host, user or "", store, when, with, key, t, value); return key; end);