fix: try Expr of only catches exceptions in Expr but not cases clauses
This commit is contained in:
parent
525bf47618
commit
91366a71a4
|
@ -90,6 +90,7 @@ get_raw_cluster_override_conf() ->
|
||||||
|
|
||||||
-spec init(term()) -> {ok, state()}.
|
-spec init(term()) -> {ok, state()}.
|
||||||
init(_) ->
|
init(_) ->
|
||||||
|
process_flag(trap_exit, true),
|
||||||
{ok, #{handlers => #{?MOD => ?MODULE}}}.
|
{ok, #{handlers => #{?MOD => ?MODULE}}}.
|
||||||
|
|
||||||
handle_call({add_handler, ConfKeyPath, HandlerName}, _From, State = #{handlers := Handlers}) ->
|
handle_call({add_handler, ConfKeyPath, HandlerName}, _From, State = #{handlers := Handlers}) ->
|
||||||
|
@ -150,12 +151,8 @@ deep_put_handler2(Key, KeyPath, Handlers, Mod) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
handle_update_request(SchemaModule, ConfKeyPath, Handlers, UpdateArgs) ->
|
handle_update_request(SchemaModule, ConfKeyPath, Handlers, UpdateArgs) ->
|
||||||
try process_update_request(ConfKeyPath, Handlers, UpdateArgs) of
|
try
|
||||||
{ok, NewRawConf, OverrideConf, Opts} ->
|
do_handle_update_request(SchemaModule, ConfKeyPath, Handlers, UpdateArgs)
|
||||||
check_and_save_configs(SchemaModule, ConfKeyPath, Handlers, NewRawConf,
|
|
||||||
OverrideConf, UpdateArgs, Opts);
|
|
||||||
{error, Result} ->
|
|
||||||
{error, Result}
|
|
||||||
catch
|
catch
|
||||||
throw : Reason ->
|
throw : Reason ->
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
|
@ -168,6 +165,15 @@ handle_update_request(SchemaModule, ConfKeyPath, Handlers, UpdateArgs) ->
|
||||||
{error, config_update_crashed}
|
{error, config_update_crashed}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
do_handle_update_request(SchemaModule, ConfKeyPath, Handlers, UpdateArgs) ->
|
||||||
|
case process_update_request(ConfKeyPath, Handlers, UpdateArgs) of
|
||||||
|
{ok, NewRawConf, OverrideConf, Opts} ->
|
||||||
|
check_and_save_configs(SchemaModule, ConfKeyPath, Handlers, NewRawConf,
|
||||||
|
OverrideConf, UpdateArgs, Opts);
|
||||||
|
{error, Result} ->
|
||||||
|
{error, Result}
|
||||||
|
end.
|
||||||
|
|
||||||
process_update_request(ConfKeyPath, _Handlers, {remove, Opts}) ->
|
process_update_request(ConfKeyPath, _Handlers, {remove, Opts}) ->
|
||||||
OldRawConf = emqx_config:get_root_raw(ConfKeyPath),
|
OldRawConf = emqx_config:get_root_raw(ConfKeyPath),
|
||||||
BinKeyPath = bin_path(ConfKeyPath),
|
BinKeyPath = bin_path(ConfKeyPath),
|
||||||
|
|
Loading…
Reference in New Issue