fix: fix dialyzer warnings
This commit is contained in:
parent
ebbb473d7a
commit
6e6643f974
|
@ -81,8 +81,8 @@ cfg_update(topic_metrics, Action, Params) ->
|
||||||
#{override_to => cluster})).
|
#{override_to => cluster})).
|
||||||
|
|
||||||
res({ok, Result}) -> {ok, Result};
|
res({ok, Result}) -> {ok, Result};
|
||||||
res({error, {pre_config_update,?MODULE,Reason}}) -> {error, Reason};
|
res({error, {pre_config_update, ?MODULE, Reason}}) -> {error, Reason};
|
||||||
res({error, {post_config_update,?MODULE,Reason}}) -> {error, Reason};
|
res({error, {post_config_update, ?MODULE, Reason}}) -> {error, Reason};
|
||||||
res({error, Reason}) -> {error, Reason}.
|
res({error, Reason}) -> {error, Reason}.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -97,7 +97,7 @@ pre_config_update(_, {add_topic_metrics, Topic0}, RawConf) ->
|
||||||
Topic = #{<<"topic">> => Topic0},
|
Topic = #{<<"topic">> => Topic0},
|
||||||
case lists:member(Topic, RawConf) of
|
case lists:member(Topic, RawConf) of
|
||||||
true ->
|
true ->
|
||||||
{error, already_exist};
|
{error, already_existed};
|
||||||
_ ->
|
_ ->
|
||||||
{ok, RawConf ++ [Topic]}
|
{ok, RawConf ++ [Topic]}
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
%% See the License for the specific language governing permissions and
|
%% See the License for the specific language governing permissions and
|
||||||
%% limitations under the License.
|
%% limitations under the License.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% TODO: refactor uri path
|
|
||||||
-module(emqx_topic_metrics_api).
|
-module(emqx_topic_metrics_api).
|
||||||
|
|
||||||
-behaviour(minirest_api).
|
-behaviour(minirest_api).
|
||||||
|
@ -151,10 +151,8 @@ topic_metrics(put, #{body := #{<<"topic">> := Topic, <<"action">> := <<"reset">>
|
||||||
{error, Reason} -> reason2httpresp(Reason)
|
{error, Reason} -> reason2httpresp(Reason)
|
||||||
end;
|
end;
|
||||||
topic_metrics(put, #{body := #{<<"action">> := <<"reset">>}}) ->
|
topic_metrics(put, #{body := #{<<"action">> := <<"reset">>}}) ->
|
||||||
case reset() of
|
reset(),
|
||||||
ok -> {200};
|
{200};
|
||||||
{error, Reason} -> reason2httpresp(Reason)
|
|
||||||
end;
|
|
||||||
|
|
||||||
topic_metrics(post, #{body := #{<<"topic">> := <<>>}}) ->
|
topic_metrics(post, #{body := #{<<"topic">> := <<>>}}) ->
|
||||||
{400, 'BAD_REQUEST', <<"Topic can not be empty">>};
|
{400, 'BAD_REQUEST', <<"Topic can not be empty">>};
|
||||||
|
@ -177,8 +175,7 @@ operate_topic_metrics(get, #{bindings := #{topic := Topic0}}) ->
|
||||||
operate_topic_metrics(delete, #{bindings := #{topic := Topic0}}) ->
|
operate_topic_metrics(delete, #{bindings := #{topic := Topic0}}) ->
|
||||||
case emqx_modules_conf:remove_topic_metrics(emqx_http_lib:uri_decode(Topic0)) of
|
case emqx_modules_conf:remove_topic_metrics(emqx_http_lib:uri_decode(Topic0)) of
|
||||||
ok -> {200};
|
ok -> {200};
|
||||||
{error, Reason} ->
|
{error, Reason} -> reason2httpresp(Reason)
|
||||||
reason2httpresp(Reason)
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -285,9 +282,9 @@ reason2httpresp({quota_exceeded, bad_topic}) ->
|
||||||
reason2httpresp(already_existed) ->
|
reason2httpresp(already_existed) ->
|
||||||
Msg = <<"Topic already registered">>,
|
Msg = <<"Topic already registered">>,
|
||||||
{400, #{code => ?BAD_TOPIC, message => Msg}};
|
{400, #{code => ?BAD_TOPIC, message => Msg}};
|
||||||
reason2httpresp(not_found) ->
|
|
||||||
Msg = <<"Topic not found">>,
|
|
||||||
{404, #{code => ?ERROR_TOPIC, message => Msg}};
|
|
||||||
reason2httpresp(topic_not_found) ->
|
reason2httpresp(topic_not_found) ->
|
||||||
|
Msg = <<"Topic not found">>,
|
||||||
|
{404, #{code => ?ERROR_TOPIC, message => Msg}};
|
||||||
|
reason2httpresp(not_found) ->
|
||||||
Msg = <<"Topic not found">>,
|
Msg = <<"Topic not found">>,
|
||||||
{404, #{code => ?ERROR_TOPIC, message => Msg}}.
|
{404, #{code => ?ERROR_TOPIC, message => Msg}}.
|
||||||
|
|
Loading…
Reference in New Issue