Diff

plugins/mod_authz_internal.lua @ 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
parent 13679:f5c7fe7bbe3b
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()