fix(rule-engine): reformat code style
This commit is contained in:
parent
38eb849ef0
commit
a3206f5e0b
|
@ -341,20 +341,19 @@ update_resource(#{id := Id}, NewParams) ->
|
|||
ok ->
|
||||
return(ok);
|
||||
{error, not_found} ->
|
||||
?LOG(error, "resource not found: ~0p", [Id]),
|
||||
return({error, 400, <<"resource not found:", Id/binary>>});
|
||||
?LOG(error, "Resource not found: ~0p", [Id]),
|
||||
return({error, 400, <<"Resource not found:", Id/binary>>});
|
||||
{error, {init_resource_failure, _}} ->
|
||||
?LOG(error, "init resource failure: ~0p", [Id]),
|
||||
return({error, 500, <<"init resource failure:", Id/binary>>});
|
||||
?LOG(error, "Init resource failure: ~0p", [Id]),
|
||||
return({error, 500, <<"Init resource failure:", Id/binary>>});
|
||||
{error, {dependency_exists, RuleId}} ->
|
||||
?LOG(error, "dependency exists: ~0p", [RuleId]),
|
||||
return({error, 500, <<"resource dependency by rule:", RuleId/binary>>});
|
||||
?LOG(error, "Dependency exists: ~0p", [RuleId]),
|
||||
return({error, 500, <<"Dependency exists:", RuleId/binary>>});
|
||||
{error, Reason} ->
|
||||
?LOG(error, "update resource failed: ~0p", [Reason]),
|
||||
return({error, 500, <<"update resource failed,error info have been written to logfile!">>})
|
||||
?LOG(error, "Resource update failed: ~0p", [Reason]),
|
||||
return({error, 500, <<"Resource update failed!">>})
|
||||
end.
|
||||
|
||||
|
||||
delete_resource(#{id := Id}, _Params) ->
|
||||
case emqx_rule_engine:delete_resource(Id) of
|
||||
ok -> return(ok);
|
||||
|
|
|
@ -173,7 +173,7 @@ resources(["update" | Params]) ->
|
|||
ok ->
|
||||
emqx_ctl:print("Resource update successfully~n");
|
||||
{error, Reason} ->
|
||||
emqx_ctl:print("update resource failed, reason: ~p!~n", [Reason])
|
||||
emqx_ctl:print("Resource update failed: ~0p~n", [Reason])
|
||||
end
|
||||
end, Params, ?OPTSPEC_RESOURCES_UPDATE, {?FUNCTION_NAME, update});
|
||||
|
||||
|
|
|
@ -454,8 +454,6 @@ t_crud_resources_api(_Config) ->
|
|||
?assertEqual(ResId, maps:get(id, Resources3)),
|
||||
?assertEqual(#{<<"a">> => 2}, maps:get(config, Resources3)),
|
||||
?assertEqual(<<"2">>, maps:get(description, Resources3)),
|
||||
{ok, #{code := 0, data := Resources3}} = emqx_rule_engine_api:show_resource(#{id => ResId},[]),
|
||||
?assertEqual(ResId, maps:get(id, Resources3)),
|
||||
%
|
||||
{ok, #{code := 0}} = emqx_rule_engine_api:update_resource(#{id => ResId},
|
||||
[{<<"config">>, [{<<"a">>, 3}]}]),
|
||||
|
@ -490,7 +488,6 @@ t_crud_resources_api(_Config) ->
|
|||
?assertMatch({ok, #{code := 404}}, emqx_rule_engine_api:show_resource(#{id => ResId}, [])),
|
||||
ok.
|
||||
|
||||
|
||||
t_list_resource_types_api(_Config) ->
|
||||
{ok, #{code := 0, data := ResourceTypes}} = emqx_rule_engine_api:list_resource_types(#{}, []),
|
||||
?assert(length(ResourceTypes) > 0),
|
||||
|
|
Loading…
Reference in New Issue