fix(emqx_license): raise throw exception instead of error

This commit is contained in:
Zaiming (Stone) Shi 2022-02-08 18:50:09 +01:00
parent cd3565d357
commit fc8eeb8819
1 changed files with 3 additions and 4 deletions

View File

@ -118,10 +118,10 @@ do_update({file, Filename}, _Conf) ->
{ok, _License} ->
#{<<"file">> => Filename};
{error, Reason} ->
error(Reason)
erlang:throw(Reason)
end;
{error, Reason} ->
error({invalid_license_file, Reason})
erlang:throw({invalid_license_file, Reason})
end;
do_update({key, Content}, _Conf) when is_binary(Content); is_list(Content) ->
@ -129,8 +129,7 @@ do_update({key, Content}, _Conf) when is_binary(Content); is_list(Content) ->
{ok, _License} ->
#{<<"key">> => Content};
{error, Reason} ->
?SLOG(error, #{msg => "failed_to_parse_license", reason => Reason}),
error(Reason)
erlang:throw(Reason)
end.
check_max_clients_exceeded(MaxClients) ->