fix(rule-engine): reformat some code
This commit is contained in:
parent
d13a33463f
commit
73655369af
|
@ -334,7 +334,7 @@ update_resource(#{id := Id}, NewParams) ->
|
|||
end,
|
||||
P2 = case proplists:get_value(<<"config">>, NewParams) of
|
||||
undefined -> #{};
|
||||
<<"{}">> -> #{};
|
||||
[{}] -> #{};
|
||||
Map -> #{<<"config">> => ?RAISE(maps:from_list(Map), {invalid_config, Map})}
|
||||
end,
|
||||
case emqx_rule_engine:update_resource(Id, maps:merge(P1, P2)) of
|
||||
|
@ -342,13 +342,13 @@ update_resource(#{id := Id}, NewParams) ->
|
|||
return(ok);
|
||||
{error, not_found} ->
|
||||
?LOG(error, "resource not found: ~0p", [Id]),
|
||||
return({error, 400, list_to_binary("resource not found:" ++ binary_to_list(Id))});
|
||||
return({error, 400, <<"resource not found:", Id/binary>>});
|
||||
{error, {init_resource_failure, _}} ->
|
||||
?LOG(error, "init resource failure: ~0p", [Id]),
|
||||
return({error, 500, list_to_binary("init resource failure:" ++ binary_to_list(Id))});
|
||||
return({error, 500, <<"init resource failure:", Id/binary>>});
|
||||
{error, {dependency_exists, RuleId}} ->
|
||||
?LOG(error, "dependency exists: ~0p", [RuleId]),
|
||||
return({error, 500, list_to_binary("resource dependency by rule:" ++ binary_to_list(RuleId))});
|
||||
return({error, 500, <<"resource dependency by rule:", RuleId/binary>>});
|
||||
{error, Reason} ->
|
||||
?LOG(error, "update resource failed: ~0p", [Reason]),
|
||||
return({error, 500, <<"update resource failed,error info have been written to logfile!">>})
|
||||
|
|
Loading…
Reference in New Issue