chore: improve a error log
This commit is contained in:
parent
bafc430184
commit
f6b3b930b0
|
@ -424,7 +424,13 @@ check_config(SchemaMod, RawConf, Opts0) ->
|
||||||
%% it's maybe too much when reporting to the user
|
%% it's maybe too much when reporting to the user
|
||||||
-spec compact_errors(any(), any()) -> no_return().
|
-spec compact_errors(any(), any()) -> no_return().
|
||||||
compact_errors(Schema, [Error0 | More]) when is_map(Error0) ->
|
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 =
|
Error =
|
||||||
case is_atom(Schema) of
|
case is_atom(Schema) of
|
||||||
true ->
|
true ->
|
||||||
|
|
|
@ -188,8 +188,7 @@ t_create_invalid_config(_Config) ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{error, #{
|
{error, #{
|
||||||
kind := validation_error,
|
kind := validation_error,
|
||||||
path := "authorization.sources.1",
|
path := "authorization.sources.1"
|
||||||
discarded_errors_count := 0
|
|
||||||
}},
|
}},
|
||||||
emqx_authz:update(?CMD_REPLACE, [C])
|
emqx_authz:update(?CMD_REPLACE, [C])
|
||||||
).
|
).
|
||||||
|
|
|
@ -850,7 +850,6 @@ test_publish_success_batch(Config) ->
|
||||||
t_not_a_json(Config) ->
|
t_not_a_json(Config) ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{error, #{
|
{error, #{
|
||||||
discarded_errors_count := 0,
|
|
||||||
kind := validation_error,
|
kind := validation_error,
|
||||||
reason := #{exception := {error, {badmap, "not a json"}}},
|
reason := #{exception := {error, {badmap, "not a json"}}},
|
||||||
%% should be censored as it contains secrets
|
%% should be censored as it contains secrets
|
||||||
|
@ -868,7 +867,6 @@ t_not_a_json(Config) ->
|
||||||
t_not_of_service_account_type(Config) ->
|
t_not_of_service_account_type(Config) ->
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{error, #{
|
{error, #{
|
||||||
discarded_errors_count := 0,
|
|
||||||
kind := validation_error,
|
kind := validation_error,
|
||||||
reason := {wrong_type, <<"not a service account">>},
|
reason := {wrong_type, <<"not a service account">>},
|
||||||
%% should be censored as it contains secrets
|
%% should be censored as it contains secrets
|
||||||
|
@ -887,7 +885,6 @@ t_json_missing_fields(Config) ->
|
||||||
GCPPubSubConfig0 = ?config(gcp_pubsub_config, Config),
|
GCPPubSubConfig0 = ?config(gcp_pubsub_config, Config),
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{error, #{
|
{error, #{
|
||||||
discarded_errors_count := 0,
|
|
||||||
kind := validation_error,
|
kind := validation_error,
|
||||||
reason :=
|
reason :=
|
||||||
{missing_keys, [
|
{missing_keys, [
|
||||||
|
|
Loading…
Reference in New Issue