Re-tagging 0.5.2
[prosody.git] / util / serialization.lua
index bff0f306fef5ae0f78e1ba75f094ae7df02cedb4..c2bbbb8d9a332cfe6c05ae89b0d03b6f600c74c1 100644 (file)
@@ -1,4 +1,4 @@
--- Prosody IM v0.4
+-- Prosody IM
 -- Copyright (C) 2008-2009 Matthew Wild
 -- Copyright (C) 2008-2009 Waqas Hussain
 -- 
@@ -14,6 +14,8 @@ local t_concat = table.concat;
 local error = error;
 local pairs = pairs;
 
+local debug_traceback = debug.traceback;
+local log = require "util.logger".init("serialization");
 module "serialization"
 
 local indent = function(i)
@@ -50,7 +52,8 @@ local function _simplesave(o, ind, t, func)
        elseif type(o) == "boolean" then
                func(t, (o and "true" or "false"));
        else
-               error("cannot serialize a " .. type(o))
+               log("error", "cannot serialize a %s: %s", type(o), debug_traceback())
+               func(t, "nil");
        end
 end