util.serialization: Log a warning when trying to serialize something we can't
authorMatthew Wild <mwild1@gmail.com>
Mon, 4 May 2009 18:35:29 +0000 (19:35 +0100)
committerMatthew Wild <mwild1@gmail.com>
Mon, 4 May 2009 18:35:29 +0000 (19:35 +0100)
util/serialization.lua

index bff0f306fef5ae0f78e1ba75f094ae7df02cedb4..41d963e905d47a956c70d5f3ed9ee164edcba692 100644 (file)
@@ -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,7 @@ 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("warn", "cannot serialize a %s: %s", type(o), debug_traceback())
        end
 end