Changeset

13827:bcb69302423e 13.0

mod_authz_internal: Improve error message when invalid role specified
author Matthew Wild <mwild1@gmail.com>
date Fri, 04 Apr 2025 16:49:55 +0100
parents 13825:042511406b99
children 13828:a071b20ccc0f
files plugins/mod_authz_internal.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_authz_internal.lua	Thu Apr 03 20:01:03 2025 +0100
+++ b/plugins/mod_authz_internal.lua	Fri Apr 04 16:49:55 2025 +0100
@@ -298,7 +298,11 @@
 end
 
 function get_role_by_name(role_name)
-	return assert(role_registry[role_name], role_name);
+	local role = role_registry[role_name];
+	if not role then
+		return error("Unknown role: "..role_name);
+	end
+	return role, role_name;
 end
 
 function get_all_roles()