25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

mod_privilege: Replace try...catch with a clean alternative

This commit is contained in:
Badlop 2024-10-01 13:23:53 +02:00
parent 4723283896
commit aa5faf1f36

View File

@ -391,8 +391,9 @@ code_change(_OldVsn, State, _Extra) ->
%%%===================================================================
-spec get_permissions(binary()) -> permissions().
get_permissions(ServerHost) ->
try ets:lookup_element(?MODULE, ServerHost, 2)
catch _:badarg -> #{}
case ets:lookup(?MODULE, ServerHost) of
[] -> #{};
[{_, Permissions}] -> Permissions
end.
-spec forward_message(message()) -> ok.