Ver código fonte

fix(api_keys): improved the error message when bootstrapping api_key

firest 1 ano atrás
pai
commit
ac6bbd2977
1 arquivos alterados com 7 adições e 1 exclusões
  1. 7 1
      apps/emqx_management/src/emqx_mgmt_auth.erl

+ 7 - 1
apps/emqx_management/src/emqx_mgmt_auth.erl

@@ -357,6 +357,11 @@ init_bootstrap_file(File) ->
             init_bootstrap_file(File, Dev, MP);
             init_bootstrap_file(File, Dev, MP);
         {error, Reason0} ->
         {error, Reason0} ->
             Reason = emqx_utils:explain_posix(Reason0),
             Reason = emqx_utils:explain_posix(Reason0),
+            FmtReason = emqx_utils:format(
+                "load API bootstrap file failed, file:~ts, reason:~ts",
+                [File, Reason]
+            ),
+
             ?SLOG(
             ?SLOG(
                 error,
                 error,
                 #{
                 #{
@@ -365,7 +370,8 @@ init_bootstrap_file(File) ->
                     reason => Reason
                     reason => Reason
                 }
                 }
             ),
             ),
-            {error, Reason}
+
+            {error, FmtReason}
     end.
     end.
 
 
 init_bootstrap_file(File, Dev, MP) ->
 init_bootstrap_file(File, Dev, MP) ->