Changeset

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
parents 2063:6055a0164d63
children 2065:624e3fed6f92
files mod_migrate/mod_migrate.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
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