Mercurial > prosody-modules
comparison mod_register_apps/mod_register_apps.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 | eb3f99d0e72d |
comparison
equal
deleted
inserted
replaced
| 4975:733e5513f691 | 4976:75b6e5df65f9 |
|---|---|
| 1 -- luacheck: ignore 631 | 1 -- luacheck: ignore 631 |
| 2 module:depends("http"); | 2 module:depends("http"); |
| 3 local http_files | 3 local http_files |
| 4 if not pcall(function() | 4 if prosody.process_type == "prosody" then |
| 5 -- Prosody >= 0.12 | 5 -- Prosody >= 0.12 |
| 6 http_files = require "net.http.files"; | 6 http_files = require "net.http.files"; |
| 7 end) then | 7 else |
| 8 -- Prosody <= 0.11 | 8 -- Prosody <= 0.11 |
| 9 http_files = module:depends "http_files"; | 9 http_files = module:depends "http_files"; |
| 10 end | 10 end |
| 11 | 11 |
| 12 local app_config = module:get_option("site_apps", { | 12 local app_config = module:get_option("site_apps", { |
