mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
mod_privilege: Replace try...catch with a clean alternative
This commit is contained in:
parent
4723283896
commit
aa5faf1f36
@ -391,8 +391,9 @@ code_change(_OldVsn, State, _Extra) ->
|
|||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
-spec get_permissions(binary()) -> permissions().
|
-spec get_permissions(binary()) -> permissions().
|
||||||
get_permissions(ServerHost) ->
|
get_permissions(ServerHost) ->
|
||||||
try ets:lookup_element(?MODULE, ServerHost, 2)
|
case ets:lookup(?MODULE, ServerHost) of
|
||||||
catch _:badarg -> #{}
|
[] -> #{};
|
||||||
|
[{_, Permissions}] -> Permissions
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec forward_message(message()) -> ok.
|
-spec forward_message(message()) -> ok.
|
||||||
|
Loading…
Reference in New Issue
Block a user