Просмотр исходного кода

style: fix wording for nxdomain and malformed_username_or_password

Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
Stefan Strigler 2 лет назад
Родитель
Сommit
84fc64822e
2 измененных файлов с 6 добавлено и 6 удалено
  1. 2 2
      apps/emqx/src/emqx_misc.erl
  2. 4 4
      apps/emqx_bridge/test/emqx_bridge_api_SUITE.erl

+ 2 - 2
apps/emqx/src/emqx_misc.erl

@@ -550,7 +550,7 @@ readable_error_msg(Error) ->
     end.
 
 to_hr_error(nxdomain) ->
-    <<"Host not found">>;
+    <<"Could not resolve host">>;
 to_hr_error(econnrefused) ->
     <<"Connection refused">>;
 to_hr_error({unauthorized_client, _}) ->
@@ -558,7 +558,7 @@ to_hr_error({unauthorized_client, _}) ->
 to_hr_error({not_authorized, _}) ->
     <<"Not authorized">>;
 to_hr_error({malformed_username_or_password, _}) ->
-    <<"Malformed username or password">>;
+    <<"Bad username or password">>;
 to_hr_error(Error) ->
     iolist_to_binary(io_lib:format("~0p", [Error])).
 

+ 4 - 4
apps/emqx_bridge/test/emqx_bridge_api_SUITE.erl

@@ -819,7 +819,7 @@ t_bridges_probe(Config) ->
         emqx_json:decode(ConnRefused, [return_maps])
     ),
 
-    {ok, 400, HostNotFound} = request(
+    {ok, 400, CouldNotResolveHost} = request(
         post,
         uri(["bridges_probe"]),
         ?MQTT_BRIDGE(<<"nohost:2883">>)
@@ -827,9 +827,9 @@ t_bridges_probe(Config) ->
     ?assertMatch(
         #{
             <<"code">> := <<"TEST_FAILED">>,
-            <<"message">> := <<"Host not found">>
+            <<"message">> := <<"Could not resolve host">>
         },
-        emqx_json:decode(HostNotFound, [return_maps])
+        emqx_json:decode(CouldNotResolveHost, [return_maps])
     ),
 
     AuthnConfig = #{
@@ -873,7 +873,7 @@ t_bridges_probe(Config) ->
     ?assertMatch(
         #{
             <<"code">> := <<"TEST_FAILED">>,
-            <<"message">> := <<"Malformed username or password">>
+            <<"message">> := <<"Bad username or password">>
         },
         emqx_json:decode(Malformed, [return_maps])
     ),