I'm using System.cmd
command to work with a file. However if the files is not found on the system, it raises ArgumentError, specifically Erlang error: :enoent
.
How can I handle this error with the case function? Here is my code so far:
case System.cmd(generate_executable(settings), ["start"]) do
{output, 0} ->
IO.inspect("Start successful")
{output, error_code} ->
IO.inspect("Start failed")
end
This cases work for mistakes from OS (whether is starts or not), but not for the erlang errors, resulting in phoenix telling me about :enoent.