Changeset

12448:fb7e76c1ad1c 0.12

configmanager: Clearer errors when providing unexpected values after VirtualHost (fixes #1735, thanks arawaks)
author Matthew Wild <mwild1@gmail.com>
date Sun, 03 Apr 2022 12:56:11 +0100
parents 12446:e54b8a5e35ad
children 12449:6ec3fbae05c9 12450:7efd4bcaa95c
files core/configmanager.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/core/configmanager.lua	Sat Apr 02 16:33:27 2022 +0200
+++ b/core/configmanager.lua	Sun Apr 03 12:56:11 2022 +0100
@@ -160,6 +160,11 @@
 			set(config_table, name or "*", "defined", true);
 			return function (config_options)
 				rawset(env, "__currenthost", "*"); -- Return to global scope
+				if type(config_options) == "string" then
+					error(format("VirtualHost entries do not accept a module name (module '%s' provided for host '%s')", config_options, name), 2);
+				elseif type(config_options) ~= "table" then
+					error("Invalid syntax following VirtualHost, expected options but received a "..type(config_options), 2);
+				end
 				for option_name, option_value in pairs(config_options) do
 					set(config_table, name or "*", option_name, option_value);
 				end