fix(dialyzer): some dialyzer issue

This commit is contained in:
Shawn 2021-12-07 09:23:22 +08:00
parent 6903997b94
commit cc96880f18
2 changed files with 4 additions and 12 deletions

View File

@ -428,11 +428,7 @@ rpc_call(Node, Mod, Fun, Args) ->
error_msg(Code, Msg) when is_binary(Msg) -> error_msg(Code, Msg) when is_binary(Msg) ->
#{code => Code, message => Msg}; #{code => Code, message => Msg};
error_msg(Code, Msg) -> error_msg(Code, Msg) ->
#{code => Code, message => list_to_binary(io_lib:format("~p", [Msg]))}. #{code => Code, message => bin(io_lib:format("~p", [Msg]))}.
bin(S) when is_atom(S) ->
atom_to_binary(S, utf8);
bin(S) when is_list(S) -> bin(S) when is_list(S) ->
list_to_binary(S); list_to_binary(S).
bin(S) when is_binary(S) ->
S.

View File

@ -261,11 +261,7 @@ schema("/connectors/:id") ->
error_msg(Code, Msg) when is_binary(Msg) -> error_msg(Code, Msg) when is_binary(Msg) ->
#{code => Code, message => Msg}; #{code => Code, message => Msg};
error_msg(Code, Msg) -> error_msg(Code, Msg) ->
#{code => Code, message => list_to_binary(io_lib:format("~p", [Msg]))}. #{code => Code, message => bin(io_lib:format("~p", [Msg]))}.
bin(S) when is_atom(S) ->
atom_to_binary(S, utf8);
bin(S) when is_list(S) -> bin(S) when is_list(S) ->
list_to_binary(S); list_to_binary(S).
bin(S) when is_binary(S) ->
S.