chore: hocon validate message
This commit is contained in:
parent
4adfe75530
commit
de5e388afb
|
@ -29,7 +29,7 @@
|
|||
{esockd, {git, "https://github.com/emqx/esockd", {tag, "5.9.2"}}},
|
||||
{ekka, {git, "https://github.com/emqx/ekka", {tag, "0.12.8"}}},
|
||||
{gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.8.1"}}},
|
||||
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.28.0"}}},
|
||||
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.28.1"}}},
|
||||
{pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}},
|
||||
{recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}},
|
||||
{snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "1.0.0"}}}
|
||||
|
|
|
@ -825,19 +825,24 @@ schema_converter(Options) ->
|
|||
maps:get(schema_converter, Options, fun hocon_schema_to_spec/2).
|
||||
|
||||
serialize_hocon_error_msg({_Schema, Errors}) ->
|
||||
Msg = lists:map(fun hocon_error/1, Errors),
|
||||
iolist_to_binary(Msg);
|
||||
Msg =
|
||||
case lists:map(fun hocon_error/1, Errors) of
|
||||
[Error0] -> Error0;
|
||||
Errors -> Errors
|
||||
end,
|
||||
iolist_to_binary(io_lib:format("~0p", [Msg]));
|
||||
serialize_hocon_error_msg(Error) ->
|
||||
iolist_to_binary(io_lib:format("~p", [Error])).
|
||||
iolist_to_binary(io_lib:format("~0p", [Error])).
|
||||
|
||||
hocon_error({Type, #{path := Path} = Error}) ->
|
||||
Error1 = maps:without([path, stacktrace], Error),
|
||||
emqx_logger_jsonfmt:best_effort_json(
|
||||
Error1#{
|
||||
<<"path">> => sub_path(Path),
|
||||
<<"type">> => Type
|
||||
},
|
||||
[]
|
||||
).
|
||||
Error1#{
|
||||
path => sub_path(Path),
|
||||
type => Type,
|
||||
reason => remove_useless_field(maps:get(reason, Error, #{}))
|
||||
}.
|
||||
|
||||
sub_path(Path) -> string:trim(Path, leading, "root.").
|
||||
|
||||
remove_useless_field(#{} = Field) -> maps:without([stacktrace], Field);
|
||||
remove_useless_field(Field) -> Field.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{emqx, {path, "../emqx"}},
|
||||
%% FIXME: tag this as v3.1.3
|
||||
{prometheus, {git, "https://github.com/deadtrickster/prometheus.erl", {tag, "v4.8.1"}}},
|
||||
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.28.0"}}}
|
||||
{hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.28.1"}}}
|
||||
]}.
|
||||
|
||||
{edoc_opts, [{preprocess, true}]}.
|
||||
|
|
2
mix.exs
2
mix.exs
|
@ -66,7 +66,7 @@ defmodule EMQXUmbrella.MixProject do
|
|||
# in conflict by emqtt and hocon
|
||||
{:getopt, "1.0.2", override: true},
|
||||
{:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "1.0.0", override: true},
|
||||
{:hocon, github: "emqx/hocon", tag: "0.28.0", override: true},
|
||||
{:hocon, github: "emqx/hocon", tag: "0.28.1", override: true},
|
||||
{:emqx_http_lib, github: "emqx/emqx_http_lib", tag: "0.5.1", override: true},
|
||||
{:esasl, github: "emqx/esasl", tag: "0.2.0"},
|
||||
{:jose, github: "potatosalad/erlang-jose", tag: "1.11.2"},
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
, {system_monitor, {git, "https://github.com/ieQu1/system_monitor", {tag, "3.0.3"}}}
|
||||
, {getopt, "1.0.2"}
|
||||
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "1.0.0"}}}
|
||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.28.0"}}}
|
||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.28.1"}}}
|
||||
, {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.5.1"}}}
|
||||
, {esasl, {git, "https://github.com/emqx/esasl", {tag, "0.2.0"}}}
|
||||
, {jose, {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.11.2"}}}
|
||||
|
|
Loading…
Reference in New Issue