# HG changeset patch # User Kim Alvefur # Date 1458549192 -3600 # Node ID c02e3d8f23fcf69cdf9a0f16d5fa28b94022c703 # Parent 439d00063620669875c3777f08808fc968b1ee70 mod_storage_sql: Make sure all serialization errors are propagated diff -r 439d00063620 -r c02e3d8f23fc plugins/mod_storage_sql.lua --- 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);