3
我正在使用System.cmd
命令来处理文件。但是,如果系统上找不到文件,则会提高,特别是Erlang error: :enoent
。 如何使用case功能处理此错误?这是我到目前为止的代码:Elixir/Phoenix处理erlang错误
case System.cmd(generate_executable(settings), ["start"]) do
{output, 0} ->
IO.inspect("Start successful")
{output, error_code} ->
IO.inspect("Start failed")
end
这种情况下,从OS错误工作(无论是启动或没有),而不是二郎神的错误,导致凤告诉我:ENOENT。
嘿@Dogbert,谢谢你的回答!我不知道尝试/营救,现在就去看看。 – Ilya