Dialyzer不知道:httpc

时间:2019-04-14 00:42:01

标签: elixir dialyzer

我正在开发Elixir,使用Erlang内置的:httpc函数执行获取请求。

if {:ok, {status, header, body}} = :httpc.request(:get, {img, []}, [], []) do
  # ...
end

功能运行良好。然后,在运行混合透析器之后,它将返回错误:

:0:unknown_function
Function :httpc.request/4 does not exist.
________________________________________________________________________________
lib/vutuv/accounts.ex:301:guard_fail
Guard test:
_ :: {:ok, {_, _, _}}

===

false

can never succeed.
________________________________________________________________________________
done (warnings were emitted)

我把这行告诉Dialyzer跳过对功能的检查。

@dialyzer {:nowarn_function, get_gravatar: 2}

但是,错误仍然存​​在

:0:unknown_function
Function :httpc.request/4 does not exist.
________________________________________________________________________________
done (warnings were emitted)

1 个答案:

答案 0 :(得分:0)

此问题已在https://elixirforum.com/t/dialyzer-does-not-know-httpc/21622/3

中解决

:inets添加到extra_applications中的mix.exs之后,一切都成功传递。