mod_migrate: Catch failure to use user listing API and suggest the alternative

Wed, 01 Nov 2017 22:12:09 +0100

author
Kim Alvefur <zash@zash.se>
date
Wed, 01 Nov 2017 22:12:09 +0100
changeset 2812
fd4a5ba12fa2
parent 2811
39156d6f7268
child 2813
e5ce64aee4ac

mod_migrate: Catch failure to use user listing API and suggest the alternative

mod_migrate/mod_migrate.lua file | annotate | diff | comparison | revisions
--- a/mod_migrate/mod_migrate.lua	Tue Oct 31 19:31:54 2017 +0100
+++ b/mod_migrate/mod_migrate.lua	Wed Nov 01 22:12:09 2017 +0100
@@ -62,9 +62,15 @@
 				migrate_user(arg[i]);
 			end
 		else
-			for user in um.users(host) do
-				migrate_user(user);
-			end
+			xpcall(function()
+				for user in um.users(host) do
+					migrate_user(user);
+				end
+			end,
+			function (err)
+				module:log("error", "Could not list users, you'll have to supply them as arguments");
+				module:log("error", "The error was: %s", err);
+			end);
 		end
 	end
 end

mercurial