comparison mod_invites_page/mod_invites_page.lua @ 4976:75b6e5df65f9

various: Improve error reporting if missing file server module on 0.12 If there is some error loading net.http.files then it would be swallowed by the pcall and then it would proceed to trying mod_http_files, which might cause unexpected behavior on 0.12 Ref #1765
author Kim Alvefur <zash@zash.se>
date Mon, 18 Jul 2022 22:47:54 +0200
parents 733e5513f691
children efdaffc878a9
comparison
equal deleted inserted replaced
4975:733e5513f691 4976:75b6e5df65f9
31 31
32 if not external_only then 32 if not external_only then
33 -- Load HTTP-serving dependencies 33 -- Load HTTP-serving dependencies
34 if prosody.shutdown then -- not if running under prosodyctl 34 if prosody.shutdown then -- not if running under prosodyctl
35 module:depends("http"); 35 module:depends("http");
36 if not pcall(function () 36
37 if prosody.process_type == "prosody" then
37 http_files = require "net.http.files"; 38 http_files = require "net.http.files";
38 end) then 39 else
39 http_files = module:depends"http_files"; 40 http_files = module:depends"http_files";
40 end 41 end
41 end 42 end
42 -- Calculate automatic base_url default 43 -- Calculate automatic base_url default
43 base_url = module.http_url and module:http_url(); 44 base_url = module.http_url and module:http_url();