comparison mod_invite/mod_invite.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 5e69a4358053
children
comparison
equal deleted inserted replaced
4975:733e5513f691 4976:75b6e5df65f9
11 11
12 local invite_storage = module:open_store(); 12 local invite_storage = module:open_store();
13 local inviter_storage = module:open_store("inviter"); 13 local inviter_storage = module:open_store("inviter");
14 14
15 local serve; 15 local serve;
16 if not pcall(function () 16 if prosody.process_type == "prosody" then
17 local http_files = require "net.http.files"; 17 local http_files = require "net.http.files";
18 serve = http_files.serve; 18 serve = http_files.serve;
19 end) then 19 else
20 serve = module:depends"http_files".serve; 20 serve = module:depends"http_files".serve;
21 end 21 end
22 22
23 module:depends"adhoc"; 23 module:depends"adhoc";
24 module:depends"http"; 24 module:depends"http";