fix: log error when failed to install plugin
the error return is a map with details. prior to this change only the reason is returned in the api response, now the error map is logged at error level to help troubleshooting
This commit is contained in:
parent
eed253af82
commit
5427ebc5f1
|
@ -399,7 +399,7 @@ do_install_package(FileName, Bin) ->
|
|||
end,
|
||||
{400, #{
|
||||
code => 'BAD_PLUGIN_INFO',
|
||||
message => iolist_to_binary([Reason, ":", FileName])
|
||||
message => iolist_to_binary([Reason, ": ", FileName])
|
||||
}}
|
||||
end.
|
||||
|
||||
|
@ -445,7 +445,8 @@ install_package(FileName, Bin) ->
|
|||
case emqx_plugins:ensure_installed(PackageName) of
|
||||
{error, #{return := not_found}} = NotFound ->
|
||||
NotFound;
|
||||
{error, _Reason} = Error ->
|
||||
{error, Reason} = Error ->
|
||||
?SLOG(error, Reason#{msg => "failed_to_install_plugin"}),
|
||||
_ = file:delete(File),
|
||||
Error;
|
||||
Result ->
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
describe(NameVsn) -> read_plugin(NameVsn, #{fill_readme => true}).
|
||||
|
||||
%% @doc Install a .tar.gz package placed in install_dir.
|
||||
-spec ensure_installed(name_vsn()) -> ok | {error, any()}.
|
||||
-spec ensure_installed(name_vsn()) -> ok | {error, map()}.
|
||||
ensure_installed(NameVsn) ->
|
||||
case read_plugin(NameVsn, #{}) of
|
||||
{ok, _} ->
|
||||
|
|
Loading…
Reference in New Issue