Sfoglia il codice sorgente

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

Shawn 4 anni fa
parent
commit
4da413c453
1 ha cambiato i file con 6 aggiunte e 2 eliminazioni
  1. 6 2
      apps/emqx_management/src/emqx_mgmt.erl

+ 6 - 2
apps/emqx_management/src/emqx_mgmt.erl

@@ -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]).