Changeset

2812:fd4a5ba12fa2

mod_migrate: Catch failure to use user listing API and suggest the alternative
author Kim Alvefur <zash@zash.se>
date Wed, 01 Nov 2017 22:12:09 +0100
parents 2811:39156d6f7268
children 2813:e5ce64aee4ac
files mod_migrate/mod_migrate.lua
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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