Wrong exception raised by K8s.Resource.from_file!/2
mruoss opened this issue · 0 comments
mruoss commented
When called passing a path to an inexistent file, K8s.Resource.from_file!/2
raises an UndefinedFunctionError
instead of the expected File.Error
:
iex> Kubernetes.Resource.from_file!("inexistent", [])
** (UndefinedFunctionError) function :enoent.exception/1 is undefined (module :enoent is not available)
:enoent.exception([])
(k8s 1.1.0) lib/k8s/resource.ex:146: K8s.Resource.from_file!/2
Reason: File.read/2 returns {:error, :enoent}
A failing test would look like this:
describe "from_file!/2" do
test "not found" do
assert_raise File.Error, fn ->
Kubernetes.Resource.from_file!("not_found.yaml", [])
end
end
end