diff mod_rest/apidemo.lib.lua @ 4938:bc8832c6696b

upstream merge
author Goffi <goffi@goffi.org>
date Wed, 11 May 2022 12:44:32 +0200
parents d5612dcf6733
children d03448560acf
line wrap: on
line diff
--- a/mod_rest/apidemo.lib.lua	Wed May 11 12:43:26 2022 +0200
+++ b/mod_rest/apidemo.lib.lua	Wed May 11 12:44:32 2022 +0200
@@ -11,7 +11,12 @@
 	});
 
 local index do
-	local f = assert(io.open(api_demo.."/index.html"), "'rest_demo_resources' should point to the 'dist' directory");
+	local f, err = io.open(api_demo.."/index.html");
+	if not f then
+		module:log("error", "Could not open resource: %s", err);
+		module:log("error", "'rest_demo_resources' should point to the 'dist' directory");
+		return _M
+	end
 	index = f:read("*a");
 	f:close();