diff options
author | Waqas Hussain <waqas20@gmail.com> | 2014-01-03 15:52:52 -0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2014-01-03 15:52:52 -0500 |
commit | 5726476f02ea34f0892481f8b1384a7266ee6180 (patch) | |
tree | 07e23117ffcab4a9f01cf9c67dc01e61e1ffe074 /tools/migration/migrator | |
parent | 035d75bf1ac848109ff4d6ce950f0162c0a5505d (diff) | |
download | prosody-5726476f02ea34f0892481f8b1384a7266ee6180.tar.gz prosody-5726476f02ea34f0892481f8b1384a7266ee6180.zip |
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.
Diffstat (limited to 'tools/migration/migrator')
-rw-r--r-- | tools/migration/migrator/prosody_files.lua | 12 |
1 files changed, 8 insertions, 4 deletions
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 "<nil>", x.host or "<nil>", x.store or "<nil>"), 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 "<nil>", x.host or "<nil>", x.store or "<nil>", err or "<nil>")); + else + return x; end - return x; + x = iter(); end end; sorter = function(a, b) |