Changeset

4928:d5612dcf6733

mod_rest/apidemo: Don't show traceback to users on config/resource problem
author Kim Alvefur <zash@zash.se>
date Sun, 17 Apr 2022 12:52:13 +0200
parents 4927:77b7e1322281
children 4929:65438e4ba563
files mod_rest/apidemo.lib.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/apidemo.lib.lua	Sun Apr 17 12:51:45 2022 +0200
+++ b/mod_rest/apidemo.lib.lua	Sun Apr 17 12:52:13 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();