fix: better error message for rule engine

This commit is contained in:
DDDHuang 2022-05-12 11:06:07 +08:00
parent 634a2fb21d
commit a284ab9cf8
1 changed files with 5 additions and 0 deletions

View File

@ -334,6 +334,11 @@ replace_sql_clrf(#{<<"sql">> := SQL} = Params) ->
%% Internal functions %% Internal functions
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
err_msg({_, [{validation_error, VMessage}]}) ->
Exp = maps:get(expected_data_type, VMessage),
Path = maps:get(path, VMessage),
ErrorArg = maps:get(got, VMessage),
list_to_binary(io_lib:format("Key ~p error, expect ~p , got ~p", [Path, Exp, ErrorArg]));
err_msg(Msg) -> err_msg(Msg) ->
list_to_binary(io_lib:format("~0p", [Msg])). list_to_binary(io_lib:format("~0p", [Msg])).