Remove extra case...of (#2082)

* Remove extra case...of
This commit is contained in:
tigercl 2018-12-20 21:42:14 +08:00 committed by turtleDeng
parent 97474171d0
commit 938d30268a
1 changed files with 7 additions and 9 deletions

View File

@ -156,15 +156,13 @@ handle_call({register_mod, Type, Mod, Opts, Seq}, _From, State) ->
reply(case lists:keymember(Mod, 1, Mods) of reply(case lists:keymember(Mod, 1, Mods) of
true -> {error, already_exists}; true -> {error, already_exists};
false -> false ->
try try Mod:init(Opts) of
case Mod:init(Opts) of {ok, ModState} ->
{ok, ModState} -> NewMods = lists:sort(fun({_, _, Seq1}, {_, _, Seq2}) ->
NewMods = lists:sort(fun({_, _, Seq1}, {_, _, Seq2}) -> Seq1 >= Seq2
Seq1 >= Seq2 end, [{Mod, ModState, Seq} | Mods]),
end, [{Mod, ModState, Seq} | Mods]), ets:insert(?TAB, {tab_key(Type), NewMods}),
ets:insert(?TAB, {tab_key(Type), NewMods}), ok
ok
end
catch catch
_:Error -> _:Error ->
emqx_logger:error("[AccessControl] Failed to init ~s: ~p", [Mod, Error]), emqx_logger:error("[AccessControl] Failed to init ~s: ~p", [Mod, Error]),