From 814d4469112d5de4ae2c1e53f09c05c42ac8c4b0 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 3 Jan 2014 15:52:52 -0500 Subject: =?UTF-8?q?tools/migration/migrator/prosody=5Ffiles:=20Fix=20undef?= =?UTF-8?q?ined=20global=20access=20of=20=E2=80=98error=E2=80=99,=20print?= =?UTF-8?q?=20the=20actual=20error=20message=20and=20correct=20file=20path?= =?UTF-8?q?=20in=20the=20error=20message=20when=20we=20fail=20to=20load=20?= =?UTF-8?q?a=20file,=20skip=20broken=20files=20instead=20of=20failing=20mi?= =?UTF-8?q?gration.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/migration/migrator/prosody_files.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tools/migration/migrator') diff --git a/tools/migration/migrator/prosody_files.lua b/tools/migration/migrator/prosody_files.lua index 4462fb3e..c9367d9c 100644 --- a/tools/migration/migrator/prosody_files.lua +++ b/tools/migration/migrator/prosody_files.lua @@ -13,6 +13,7 @@ local next = next; local pairs = pairs; local json = require "util.json"; local os_getenv = os.getenv; +local error = error; prosody = {}; local dm = require "util.datamanager" @@ -95,15 +96,18 @@ function reader(input) local iter = mtools.sorted { reader = function() local x = iter(); - if x then + while x do dm.set_data_path(path); local err; x.data, err = dm.load(x.user, x.host, x.store); if x.data == nil and err then - error(("Error loading data at path %s for %s@%s (%s store)") - :format(path, x.user or "", x.host or "", x.store or ""), 0); + local p = dm.getpath(x.user, x.host, x.store); + print(("Error loading data at path %s for %s@%s (%s store): %s") + :format(p, x.user or "", x.host or "", x.store or "", err or "")); + else + return x; end - return x; + x = iter(); end end; sorter = function(a, b) -- cgit v1.2.3