Przeglądaj źródła

chore: improve a error log

Zaiming (Stone) Shi 3 lat temu
rodzic
commit
f6b3b930b0

+ 7 - 1
apps/emqx/src/emqx_config.erl

@@ -424,7 +424,13 @@ check_config(SchemaMod, RawConf, Opts0) ->
 %% it's maybe too much when reporting to the user
 -spec compact_errors(any(), any()) -> no_return().
 compact_errors(Schema, [Error0 | More]) when is_map(Error0) ->
-    Error1 = Error0#{discarded_errors_count => length(More)},
+    Error1 =
+        case length(More) of
+            0 ->
+                Error0;
+            _ ->
+                Error0#{unshown_errors => length(More)}
+        end,
     Error =
         case is_atom(Schema) of
             true ->

+ 1 - 2
apps/emqx_authz/test/emqx_authz_redis_SUITE.erl

@@ -188,8 +188,7 @@ t_create_invalid_config(_Config) ->
     ?assertMatch(
         {error, #{
             kind := validation_error,
-            path := "authorization.sources.1",
-            discarded_errors_count := 0
+            path := "authorization.sources.1"
         }},
         emqx_authz:update(?CMD_REPLACE, [C])
     ).

+ 0 - 3
lib-ee/emqx_ee_bridge/test/emqx_ee_bridge_gcp_pubsub_SUITE.erl

@@ -850,7 +850,6 @@ test_publish_success_batch(Config) ->
 t_not_a_json(Config) ->
     ?assertMatch(
         {error, #{
-            discarded_errors_count := 0,
             kind := validation_error,
             reason := #{exception := {error, {badmap, "not a json"}}},
             %% should be censored as it contains secrets
@@ -868,7 +867,6 @@ t_not_a_json(Config) ->
 t_not_of_service_account_type(Config) ->
     ?assertMatch(
         {error, #{
-            discarded_errors_count := 0,
             kind := validation_error,
             reason := {wrong_type, <<"not a service account">>},
             %% should be censored as it contains secrets
@@ -887,7 +885,6 @@ t_json_missing_fields(Config) ->
     GCPPubSubConfig0 = ?config(gcp_pubsub_config, Config),
     ?assertMatch(
         {error, #{
-            discarded_errors_count := 0,
             kind := validation_error,
             reason :=
                 {missing_keys, [