refactor: improve error messages
This commit is contained in:
parent
795d280861
commit
b14856cf1a
|
@ -55,7 +55,10 @@ map_bad_ssl_error(#{pem_check := invalid_pem} = TLSLibError) ->
|
|||
kind => validation_error,
|
||||
reason => <<"bad_ssl_config">>,
|
||||
bad_fields => Paths,
|
||||
file_read_error => Reason
|
||||
details => emqx_utils:format(
|
||||
"Failed to access certificate / key file: ~s",
|
||||
[emqx_utils:explain_posix(Reason)]
|
||||
)
|
||||
};
|
||||
map_bad_ssl_error(#{which_options := Paths, reason := Reason}) ->
|
||||
#{
|
||||
|
|
|
@ -738,7 +738,8 @@ t_create_with_bad_tls_files(Config) ->
|
|||
#{
|
||||
<<"kind">> := <<"validation_error">>,
|
||||
<<"reason">> := <<"bad_ssl_config">>,
|
||||
<<"file_read_error">> := <<"enoent">>,
|
||||
<<"details">> :=
|
||||
<<"Failed to access certificate / key file: No such file or directory">>,
|
||||
<<"bad_fields">> := [[<<"cacertfile">>]]
|
||||
},
|
||||
json(Msg0)
|
||||
|
|
|
@ -238,7 +238,7 @@ t_persist_ssl_certfiles(Config) ->
|
|||
list_ssl_certfiles(Config)
|
||||
),
|
||||
?assertMatch(
|
||||
{error, {pre_config_update, _, {bad_ssl_config, #{}}}},
|
||||
{error, {pre_config_update, _, #{reason := <<"bad_ssl_config">>}}},
|
||||
emqx_ft_conf:update(
|
||||
mk_storage(true, #{
|
||||
<<"s3">> => mk_s3_config(#{
|
||||
|
|
Loading…
Reference in New Issue