aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2025-04-04 16:49:55 +0100
committerMatthew Wild <mwild1@gmail.com>2025-04-04 16:49:55 +0100
commitb08fa464dcc210d76f5c69783c240b5db4dd8980 (patch)
treec444392037df46e150afa511774791e7bd63f029
parentf81c17aeaddc50c90d066c11f07ddf76f348efdc (diff)
downloadprosody-b08fa464dcc210d76f5c69783c240b5db4dd8980.tar.gz
prosody-b08fa464dcc210d76f5c69783c240b5db4dd8980.zip
mod_authz_internal: Improve error message when invalid role specified
-rw-r--r--plugins/mod_authz_internal.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_authz_internal.lua b/plugins/mod_authz_internal.lua
index f683d90c..1282f617 100644
--- a/plugins/mod_authz_internal.lua
+++ b/plugins/mod_authz_internal.lua
@@ -298,7 +298,11 @@ function add_default_permission(role_name, action, policy)
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()