Software /
code /
prosody-modules
Diff
mod_rest/apidemo.lib.lua @ 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 |
parent | 4728:1c6d353550cc |
child | 5220:d03448560acf |
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();