# HG changeset patch # User Waqas Hussain # Date 1388782372 18000 # Node ID 9ce0d246c851045df1fbbb3eb3b6ab0edcddf377 # Parent 1c08d6cca55276df3923fcd436ca761db2c55239 tools/migration/migrator/prosody_files: Fix undefined global access of ‘error’, print the actual error message and correct file path in the error message when we fail to load a file, skip broken files instead of failing migration. diff -r 1c08d6cca552 -r 9ce0d246c851 tools/migration/migrator/prosody_files.lua --- a/tools/migration/migrator/prosody_files.lua Wed Dec 18 18:35:35 2013 +0100 +++ b/tools/migration/migrator/prosody_files.lua Fri Jan 03 15:52:52 2014 -0500 @@ -13,6 +13,7 @@ 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 @@ 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)