fix(emqx_config_handler): do not log throw exception
This commit is contained in:
parent
fc8eeb8819
commit
a86b684535
|
@ -102,24 +102,8 @@ handle_call({add_handler, ConfKeyPath, HandlerName}, _From, State = #{handlers :
|
||||||
|
|
||||||
handle_call({change_config, SchemaModule, ConfKeyPath, UpdateArgs}, _From,
|
handle_call({change_config, SchemaModule, ConfKeyPath, UpdateArgs}, _From,
|
||||||
#{handlers := Handlers} = State) ->
|
#{handlers := Handlers} = State) ->
|
||||||
Reply = try
|
Result = handle_update_request(SchemaModule, ConfKeyPath, Handlers, UpdateArgs),
|
||||||
case process_update_request(ConfKeyPath, Handlers, UpdateArgs) of
|
{reply, Result, State};
|
||||||
{ok, NewRawConf, OverrideConf, Opts} ->
|
|
||||||
check_and_save_configs(SchemaModule, ConfKeyPath, Handlers, NewRawConf,
|
|
||||||
OverrideConf, UpdateArgs, Opts);
|
|
||||||
{error, Result} ->
|
|
||||||
{error, Result}
|
|
||||||
end
|
|
||||||
catch Error:Reason:ST ->
|
|
||||||
?SLOG(error, #{
|
|
||||||
msg => "change_config_failed",
|
|
||||||
exception => Error,
|
|
||||||
reason => Reason,
|
|
||||||
stacktrace => ST
|
|
||||||
}),
|
|
||||||
{error, Reason}
|
|
||||||
end,
|
|
||||||
{reply, Reply, State};
|
|
||||||
handle_call(get_raw_cluster_override_conf, _From, State) ->
|
handle_call(get_raw_cluster_override_conf, _From, State) ->
|
||||||
Reply = emqx_config:read_override_conf(#{override_to => cluster}),
|
Reply = emqx_config:read_override_conf(#{override_to => cluster}),
|
||||||
{reply, Reply, State};
|
{reply, Reply, State};
|
||||||
|
@ -165,6 +149,25 @@ deep_put_handler2(Key, KeyPath, Handlers, Mod) ->
|
||||||
Error
|
Error
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
handle_update_request(SchemaModule, ConfKeyPath, Handlers, UpdateArgs) ->
|
||||||
|
try 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}
|
||||||
|
catch
|
||||||
|
throw : Reason ->
|
||||||
|
{error, Reason};
|
||||||
|
Error : Reason : ST ->
|
||||||
|
?SLOG(error, #{msg => "change_config_failed",
|
||||||
|
exception => Error,
|
||||||
|
reason => Reason,
|
||||||
|
stacktrace => ST
|
||||||
|
}),
|
||||||
|
{error, config_update_crashed}
|
||||||
|
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