Software /
code /
prosody-modules
Diff
mod_migrate/mod_migrate.lua @ 2064:2a82c55762a7
mod_migrate: Log read and write errors instead of raising error
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 07 Mar 2016 12:44:29 +0100 |
parent | 2028:530bf8ef2e55 |
child | 2139:17408ddd34b0 |
line wrap: on
line diff
--- a/mod_migrate/mod_migrate.lua Mon Mar 07 11:15:28 2016 +0100 +++ b/mod_migrate/mod_migrate.lua Mon Mar 07 12:44:29 2016 +0100 @@ -24,8 +24,14 @@ local function migrate_user(username) module:log("info", "Migrating %s data for %s", source_store, username); local data, err = storage:get(username); - assert(data or err==nil, err); - assert(target:set(username, data)); + if not data and err then + module:log("error", "Could not read data: %s", err); + else + local ok, err = target:set(username, data); + if not ok then + module:log("error", "Could not write data: %s", err); + end + end end if store_type == "archive" then