fix(APIs): clarify the error message when update listener failed

This commit is contained in:
Shawn 2021-08-30 20:51:30 +08:00
parent 50ccaec4b0
commit 4da413c453
1 changed files with 6 additions and 2 deletions

View File

@ -507,8 +507,12 @@ update_listener(Id, Config) ->
update_listener(Node, Id, Config) when Node =:= node() ->
{Type, Name} = emqx_listeners:parse_listener_id(Id),
{ok, #{raw_config := RawConf}} = emqx:update_config([listeners, Type, Name], Config, #{}),
RawConf#{node => Node, id => Id, running => true};
case emqx:update_config([listeners, Type, Name], Config, #{}) of
{ok, #{raw_config := RawConf}} ->
RawConf#{node => Node, id => Id, running => true};
{error, Reason} ->
error(Reason)
end;
update_listener(Node, Id, Config) ->
rpc_call(Node, update_listener, [Node, Id, Config]).