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,
|
||||
#{handlers := Handlers} = State) ->
|
||||
Reply = try
|
||||
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
|
||||
catch Error:Reason:ST ->
|
||||
?SLOG(error, #{
|
||||
msg => "change_config_failed",
|
||||
exception => Error,
|
||||
reason => Reason,
|
||||
stacktrace => ST
|
||||
}),
|
||||
{error, Reason}
|
||||
end,
|
||||
{reply, Reply, State};
|
||||
Result = handle_update_request(SchemaModule, ConfKeyPath, Handlers, UpdateArgs),
|
||||
{reply, Result, State};
|
||||
handle_call(get_raw_cluster_override_conf, _From, State) ->
|
||||
Reply = emqx_config:read_override_conf(#{override_to => cluster}),
|
||||
{reply, Reply, State};
|
||||
|
@ -165,6 +149,25 @@ deep_put_handler2(Key, KeyPath, Handlers, Mod) ->
|
|||
Error
|
||||
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}) ->
|
||||
OldRawConf = emqx_config:get_root_raw(ConfKeyPath),
|
||||
BinKeyPath = bin_path(ConfKeyPath),
|
||||
|
|
Loading…
Reference in New Issue